From 18539bb5ba35694d34573e49dc36b49405d0eb59 Mon Sep 17 00:00:00 2001 From: Christos Spirotis Date: Thu, 17 Dec 2020 14:31:48 +0000 Subject: [PATCH] ELGIP-122 Changes so that POF_TX_0 uses auto-generated registers --- generic_ip/pof_protocol/0/sim/sim_pof_txrx.do | 2 + generic_ip/pof_protocol/0/src/pof_tx_0.vhd | 67 +++++++++---------- 2 files changed, 34 insertions(+), 35 deletions(-) diff --git a/generic_ip/pof_protocol/0/sim/sim_pof_txrx.do b/generic_ip/pof_protocol/0/sim/sim_pof_txrx.do index 8d3dcc6..aed6ec0 100644 --- a/generic_ip/pof_protocol/0/sim/sim_pof_txrx.do +++ b/generic_ip/pof_protocol/0/sim/sim_pof_txrx.do @@ -38,6 +38,8 @@ vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire.vhd vcom -2008 -work $WORKLIB $COMMON_PATH/sync_wire_redge.vhd #vcom -2008 -work $WORKLIB ../src/altera/fifo_16x8.vhd vcom -2008 -work $WORKLIB $COMMON_PATH/altera/sync_fifo.vhd +vcom -2008 -work $WORKLIB ../src/pof_tx_0_pkg_auto.vhd +vcom -2008 -work $WORKLIB ../src/pof_tx_0_csr_regs_auto.vhd vcom -2008 -work $WORKLIB ../src/uart_tx_0.vhd vcom -2008 -work $WORKLIB ../src/pof_uart_rx_0.vhd vcom -2008 -work $WORKLIB ../src/pof_tx_0.vhd diff --git a/generic_ip/pof_protocol/0/src/pof_tx_0.vhd b/generic_ip/pof_protocol/0/src/pof_tx_0.vhd index fb77229..17a28aa 100644 --- a/generic_ip/pof_protocol/0/src/pof_tx_0.vhd +++ b/generic_ip/pof_protocol/0/src/pof_tx_0.vhd @@ -225,47 +225,44 @@ gray <= bin2gray(latched_pos) when (pd_event_d = '1' or pd_event_dd = '1') else -- C&S registers ----------------------------------------------------------------------------- + pof_tx_0_csr_regs_inst : entity work.pof_tx_0_csr_regs + generic map ( + ADDR_DECODE_WIDTH => 3 + ) + port map ( + -- Clock and reset + clk => clk, + rst_n => reset_n, + + -- auto-generated + + -- Internal signal ports + csr_enable => enable, + csr_bit_div => bit_div, + timing_keepalive_period => keepalive_period, + timing_init_blocked_period => init_blocked_period, + csr_clr_fifo_level_max => clr_fifo_lmax, + error_inject => inject_error_req, + csr_ovfl_err => ovfl_err, + fifo_level_fifo_level => fifo_level, + fifo_level_max_fifo_level => fifo_level_max, + + -- end auto-generated + + -- Slave bus port + avs_address => avs_address(2 downto 0), + avs_write => avs_write, + avs_writedata => avs_writedata, + avs_read => avs_read, + avs_readdata => avs_readdata + ); + pCTRL_STATUS : process(reset_n, clk) begin if(reset_n = '0') then avs_readdatavalid <= '0'; - enable <= '0'; - clr_fifo_lmax <= '0'; - bit_div <= "0010"; - keepalive_period <= std_logic_vector(to_unsigned(KEEPALIVE_PERIOD_DEF, 10)); - init_blocked_period <= std_logic_vector(to_unsigned(INIT_BLOCKED_PERIOD_DEF, 10)); elsif(clk = '1' and clk'event) then - inject_error_req <= '0'; - clr_fifo_lmax <= '0'; - -- CTRL registers - if(avs_write = '1') then - case avs_address is - when CSR => - enable <= avs_writedata(0); - clr_fifo_lmax <= avs_writedata(2); - bit_div <= avs_writedata(7 downto 4); - when ERROR_INJ_REG => - inject_error_req <= avs_writedata(0); - when TIMING_REG => - keepalive_period <= avs_writedata( 9 downto 0); - init_blocked_period <= avs_writedata(25 downto 16); - when others => null; - end case; - end if; - -- Read Ctrl & Status registers avs_readdatavalid <= avs_read; - if(avs_read = '1') then - case avs_address is - when CSR => - avs_readdata <= X"000000" & bit_div & b"0" & clr_fifo_lmax & ovfl_err & enable; - when TIMING_REG => - avs_readdata <= 6x"0" & init_blocked_period & 6x"0" & keepalive_period; - when FIFO_LEVEL_REG => - avs_readdata <= 6x"0" & fifo_level_max & 6x"0" & fifo_level; - when others => - avs_readdata <= X"BAD1BAD0"; - end case; - end if; end if; end process pCTRL_STATUS;