Commit 0f9d2c92 authored by Theodor-Adrian Stana's avatar Theodor-Adrian Stana

Several changes to top-level file

- connecting WRPC's SPI outputs to the conv-common-gw flash outputs
- the flash outputs are multiplexed between the WRPC and the multiboot
logic (MultiBoot logic has priority)
- re-generating the code for local PPS generation when the hardware
one-wire master is generated (gen_with_therm)
- the PPS output is obtained from the WRPC when WR is present
- connecting the WRPC's timing outputs to the time-tagging core
parent 5bd9f866
......@@ -407,8 +407,9 @@ architecture arch of conv_common_gw is
-- Temperature sensor signals
signal tempr : std_logic_vector(15 downto 0);
signal uidr : std_logic_vector(63 downto 0);
signal local_pps_p : std_logic;
signal local_pps_cnt : unsigned(24 downto 0);
signal pps_p : std_logic;
signal pps_cnt : unsigned(24 downto 0);
-- MGT phy signals
signal phy_tx_data : std_logic_vector(7 downto 0);
......@@ -435,6 +436,22 @@ architecture arch of conv_common_gw is
signal dac_hpll_load_p : std_logic;
signal dac_hpll_data : std_logic_vector(15 downto 0);
-- SPI signals to the flash chip
signal spi_mb_cs_n : std_logic;
signal spi_mb_sclk : std_logic;
signal spi_mb_mosi : std_logic;
signal spi_mb_miso : std_logic;
signal spi_wr_cs_n : std_logic;
signal spi_wr_sclk : std_logic;
signal spi_wr_mosi : std_logic;
signal spi_wr_miso : std_logic;
-- WR timing signals
signal wr_tm_cycles : std_logic_vector(27 downto 0);
signal wr_tm_tai : std_logic_vector(39 downto 0);
signal wr_tm_time_valid : std_logic;
signal wr_pps_p : std_logic;
--==============================================================================
-- architecture begin
--==============================================================================
......@@ -717,9 +734,9 @@ gen_pulse_timetag : if (g_with_pulse_timetag = true) generate
pulse_a_i => trig_chan,
-- Time inputs from White Rabbit
wr_tm_cycles_i => (others => '0'),
wr_tm_tai_i => (others => '0'),
wr_tm_valid_i => '0',
wr_tm_cycles_i => wr_tm_cycles,
wr_tm_tai_i => wr_tm_tai,
wr_tm_valid_i => wr_tm_time_valid,
-- Timing inputs from Wishbone-mapped registers
wb_tm_tai_l_i => tvlr,
......@@ -1261,17 +1278,51 @@ end generate gen_latest_timestamp_unused_chans;
rst_n_i => rst_20_n,
wbs_i => xbar_master_out(c_slv_multiboot),
wbs_o => xbar_master_in(c_slv_multiboot),
spi_cs_n_o => flash_cs_n_o,
spi_sclk_o => flash_sclk_o,
spi_mosi_o => flash_mosi_o,
spi_miso_i => flash_miso_i
spi_cs_n_o => spi_mb_cs_n,
spi_sclk_o => spi_mb_sclk,
spi_mosi_o => spi_mb_mosi,
spi_miso_i => spi_mb_miso
);
-- SPI flash bus shared between MultiBoot logic and WR logic
-- NOTE: MultiBoot logic has priority over WR
flash_cs_n_o <= spi_mb_cs_n when (spi_mb_cs_n = '0') else
spi_wr_cs_n;
flash_sclk_o <= spi_mb_sclk when (spi_mb_cs_n = '0') else
spi_wr_sclk;
flash_mosi_o <= spi_mb_mosi when (spi_mb_cs_n = '0') else
spi_wr_mosi;
spi_mb_miso <= flash_miso_i when (spi_mb_cs_n = '0') else
'0';
--============================================================================
-- On-board DS18B20 Thermometer logic
--============================================================================
--------------------------------------------------------------------------------
gen_thermometer : if (g_with_thermometer = true) generate
-- PPS counter for the thermometer module
p_therm_pps : process (clk_20_i)
begin
if rising_edge(clk_20_i) then
if (rst_20_n = '0') then
local_pps_cnt <= (others => '0');
local_pps_p <= '0';
else
local_pps_p <= '0';
local_pps_cnt <= local_pps_cnt + 1;
if (local_pps_cnt = 19999999) then
local_pps_p <= '1';
local_pps_cnt <= (others => '0');
end if;
end if;
end if;
end process p_therm_pps;
-- PPS pulse to thermometer is either WR-based, or local
pps_p <= wr_pps_p when (wr_tm_time_valid = '1') else
local_pps_p;
-- Finally, instantiate the thermometer component
cmp_therm : serialIdTempInt
generic map (
FREQ => 20
......@@ -1370,9 +1421,9 @@ gen_with_wr : if (g_with_wr = true) generate
g_simulation => 0,
g_with_external_clock_input => false,
--
g_phys_uart => true,
g_virtual_uart => false,
g_aux_clks => 1,
g_phys_uart => false,
g_virtual_uart => true,
g_aux_clks => 0,
g_ep_rxbuf_size => 1024,
g_dpram_initf => "wrc.ram",
g_dpram_size => 90112/4, --16384,
......@@ -1419,6 +1470,11 @@ gen_with_wr : if (g_with_wr = true) generate
sfp_det_i => sfp_present_i,
btn1_i => '0',
btn2_i => '0',
spi_sclk_o => spi_wr_sclk,
spi_ncs_o => spi_wr_cs_n,
spi_mosi_o => spi_wr_mosi,
spi_miso_i => spi_wr_miso,
uart_rxd_i => '1',
uart_txd_o => open,
......@@ -1441,16 +1497,20 @@ gen_with_wr : if (g_with_wr = true) generate
tm_dac_wr_o => open,
tm_clk_aux_lock_en_i => (others=>'0'),
tm_clk_aux_locked_o => open,
tm_time_valid_o => open,
tm_tai_o => open,
tm_cycles_o => open,
pps_p_o => pps_p,
tm_time_valid_o => wr_tm_time_valid,
tm_tai_o => wr_tm_tai,
tm_cycles_o => wr_tm_cycles,
pps_p_o => wr_pps_p,
pps_led_o => open,
dio_o => open,
rst_aux_n_o => open
);
-- SPI interface to the flash chip
spi_wr_miso <= flash_miso_i when (spi_wr_cs_n = '0') else
'0';
-- Connect the SFP's I2C interface to the WRPC signals
sfp_scl_b <= '0' when sfp_scl_fr_wrpc = '0' else 'Z';
sfp_sda_b <= '0' when sfp_sda_fr_wrpc = '0' else 'Z';
......@@ -1591,6 +1651,18 @@ gen_no_wr : if (g_with_wr = false) generate
sfp_sda_b <= 'Z';
sfp_tx_disable_o <= 'Z';
-- Connect SPI lines to idle from WR, so it doesn't interfere with the
-- MultiBoot module
spi_wr_sclk <= '0';
spi_wr_cs_n <= '1';
spi_wr_mosi <= '0';
spi_wr_miso <= '0';
-- Connect WR timing signals to zeroes
wr_tm_time_valid <= '0';
wr_tm_cycles <= (others => '0');
wr_tm_tai <= (others => '0');
-- MGT signals
cmp_clk_gtp : IBUFGDS
generic map
......@@ -1654,26 +1726,6 @@ gen_no_wr : if (g_with_wr = false) generate
pad_rxp1_i => '0'
);
-- Implement PPS counter for the thermometer module (normally from WR)
gen_therm_pps_no_wr : if (g_with_thermometer = true) generate
p_therm_pps : process (clk_20_i)
begin
if rising_edge(clk_20_i) then
if (rst_20_n = '0') then
pps_cnt <= (others => '0');
pps_p <= '0';
else
pps_p <= '0';
pps_cnt <= pps_cnt + 1;
if (pps_cnt = 19999999) then
pps_p <= '1';
pps_cnt <= (others => '0');
end if;
end if;
end if;
end process p_therm_pps;
end generate gen_therm_pps_no_wr;
end generate gen_no_wr;
--------------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment