CORE-798 Make EL GIP Library FPGA Vendor Independent.

Fix errors caused by versioning
This commit is contained in:
David Steele 2023-01-13 14:46:49 +00:00
commit 1a143380bb
14 changed files with 1132 additions and 213 deletions

View file

@ -30,9 +30,9 @@ entity rw_dp_ram_1 is
rddata_a : out std_logic_vector (DATA_WIDTH-1 downto 0);
rddata_b : out std_logic_vector (DATA_WIDTH-1 downto 0)
);
end rw_dp_ram;
end rw_dp_ram_1;
architecture struct of rw_dp_ram is
architecture struct of rw_dp_ram_1 is
--{{{
component alt_rw_dp_ram_1

View file

@ -76,7 +76,7 @@ architecture struct of sync_fifo_1 is
end component;
--}}}
--{{{
component efx_fifo is_1
component efx_fifo_1
generic (
FAMILY : string := "TRION";
SYNC_CLK : integer := 1;

View file

@ -255,7 +255,7 @@ begin
cmd_queue_rst <= control_clear_cmd or cmd_queue_rst_sreg(cmd_queue_rst_sreg'LENGTH - 1);
-- Instantiate the command queue
cmd_queue_inst : entity work.sync_fifo
cmd_queue_inst : entity work.sync_fifo_1
generic map(
DATA_WIDTH => 32,
DEPTH => CMD_QUEUE_DEPTH,
@ -287,7 +287,7 @@ begin
-- ---------------------------------------
GEN_TLB : if not EXCLUDE_VIRTUAL_MAPPING_LOGIC generate
tlb_queue_inst : entity work.sync_fifo
tlb_queue_inst : entity work.sync_fifo_1
generic map(
DATA_WIDTH => 40,
DEPTH => CMD_QUEUE_DEPTH,
@ -867,4 +867,4 @@ begin
end if;
end process;
end architecture;
end architecture;

View file

@ -154,7 +154,7 @@ begin -- RTL
fine_time_corrected <= std_logic_vector(unsigned(fine_time)-1);
-- FIFO_A : Event Source and Time-Tag
iFIFO_A : entity work.sync_fifo
iFIFO_A : entity work.sync_fifo_1
generic map (
DEVICE_FAMILY => DEVICE_FAMILY,
DATA_WIDTH => 32,
@ -174,7 +174,7 @@ begin -- RTL
usedw => fifo_usedw);
-- FIFO_B: Position-Tag
iFIFO_B : entity work.sync_fifo
iFIFO_B : entity work.sync_fifo_1
generic map (
DEVICE_FAMILY => DEVICE_FAMILY,
DATA_WIDTH => 32,

View file

@ -406,7 +406,7 @@ begin
pd_p <= pd_out_p when pd_log_src = '1' else filt_prod_det_p;
iPD_log_fifo : entity work.sync_fifo
iPD_log_fifo : entity work.sync_fifo_1
generic map(
DEVICE_FAMILY => DEVICE_FAMILY,
DATA_WIDTH => 32,
@ -494,7 +494,7 @@ begin
sampling_time <= '1' when unsigned(sampling_time_cnt) = unsigned(sampling_period) else '0';
iEncPulseFifo : entity work.sync_fifo
iEncPulseFifo : entity work.sync_fifo_1
generic map(
DEVICE_FAMILY => DEVICE_FAMILY,
DATA_WIDTH => 32,

View file

@ -279,7 +279,7 @@ begin
--
-- This FIFO stores the data to be delayed
--
fifo_delay_queue_data : entity work.sync_fifo
fifo_delay_queue_data : entity work.sync_fifo_1
generic map(
DATA_WIDTH => DATA_WIDTH,
DEPTH => DATA_DEPTH,
@ -307,7 +307,7 @@ begin
--
-- This FIFO stores the timestamp at which the data is released
--
fifo_delay_queue_delay : entity work.sync_fifo
fifo_delay_queue_delay : entity work.sync_fifo_1
generic map(
DATA_WIDTH => DELAY_WIDTH,
DEPTH => DELAY_DEPTH,
@ -334,7 +334,7 @@ begin
--
-- This FIFO stores the size of the packet (when in packet mode)
--
fifo_delay_queue_length : entity work.sync_fifo
fifo_delay_queue_length : entity work.sync_fifo_1
generic map(
DATA_WIDTH => LENGTH_WIDTH,
DEPTH => LENGTH_DEPTH,

View file

@ -180,7 +180,7 @@ begin
avs_readdata => avs_csr_readdata
);
dp_mem_inst : entity work.dp_ram
dp_mem_inst : entity work.dp_ram_1
generic map (
DATA_WIDTH => 32,
DEPTH => 64,
@ -384,4 +384,4 @@ begin
end if;
end process;
end architecture rtl;
end architecture rtl;

View file

@ -0,0 +1,542 @@
-------------------------------------------------------------------------------
--! @file
--! @brief SOM FPGA pixel buffer
--!
--! @details This block is the the data core pixel buffer for the Presto projects.
--! it stores pixel strip data, with a write port from the print streamer, and
--! a read port from the data core slicer. The memory is organised into 18
--! (one for each data bit maximum) buffers of 32 bits x 64 deep, giving a
--! maximum capacity of over 10 stripes in 3bpp mode. The write control logic
--! will stripe received words into the buffers, from 0 to output width (6 or
--! 18) minus 1, moving on to next buffer after 64 pixels worth of data. Read
--! data is read from all buffers in parallel. Start requests without a 'first'
--! status resets the read pointer to beginning of stripe, to allow multi-wave
--! grey level operation. A start request with a 'first' status allows the
--! read pointer to advance to next stripe. See
--! https://confluence.gisapps.co.uk/pages/viewpage.action?spaceKey=GMAHMB&title=HMB-FD-GMA+Design+Documentation
--!
--! @b Clock/resets:
--! @li clk : nominally 100MHz
--! @li rst_n : active low reset for clk (asynchronous assert)
--!
--! @b Interfaces:
--! @li pixel_buf_rdy : Ready status output towards print streamer
--! @li data : pixel data from print streamer
--! @li last_word : Flag input indicating data is the last word of an image's stripes
--! @li all_on : ALL ON mode input
--! @li wrreq : buffer write request from print streamer
--! @li q : pixel read data to GL remapper
--! @li rdreq : pixel read request from GL remapper
--! @li empty : buffer empty status.
--! @li full : buffer full (with look-ahead) status
--! @li overrun : Pixel buffer overrun error status
--! @li underrun : Pixel buffer underrun error status
--! @li fp_drop : Fire pulse drop seen
--! @li dbl_drop : Double fire pulse 'droppy' error status
--! @li print_data_width : print output data width (6 or 18 for GMA)
--! @li clear_buffer : Pixel buffer clear pulse input
--! @li start_req : start request pulse from print data sequencer, via delay queue
--! @li start_req_first : start request first wave/next stripe status from print data sequencer, via delay queue
--! @li start_req_last : start request last wave status from print data sequencer, via delay queue
--! @li is_last_wave : Status output flagging processing last wave
--! @li fire_req : Fire pulse request input
--! @li sequencers_busy : Status output indicating sequences busy with respect to accepting a new fire pulse
--! @li fp_holdoff_update : Strobe input to indicate valid holdoff data (wave sequence length)
--! @li wave_seq_len : Wave sequence length input, in clock cycles for fire request holdoff
--! @li diag_peek_* : Diagnostic buffer read and write peek and poke interface (enabled on EN_PEEK generic
--! @li ip_id_ip_number : Module's ID number
--! @li ip_id_mfr_number : Module's manufacture number
--! @li ip_ver_minor_number : Module's Minor version number
--! @li ip_ver_major_number : Module's Major version number
--!
--! @b Clock-crossing considerations:
--! @li Module is a single clock domain synchronous block
--!
--! @b Language build standard requirements:
--! @li VHDL 2008
--!
--! @author Simon Southwell
--! @copyright (c) 2018 Global Inkjet Systems
--! @date 2018-4-12
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.common_pkg.all;
entity pixel_buffer_1 IS
generic (
MAX_OP_WIDTH : natural range 1 to 48 := 48;
SHIFT_DEPTH : integer range 1 to 1024 := 128;
PX_DEPTH : integer range 2 to 1024 := 64;
RSVD_DEPTH : integer range 0 to 1024 := 0;
FULL_MARGIN : integer range 2 to 1024 := 8;
EN_PEEK : boolean := false;
VECTORED_RDREQ : boolean := false;
DEVICE_FAMILY : string := "Cyclone V" -- "Cyclone 10 LP"
);
port
(
clk : in std_logic;
rst_n : in std_logic;
pixel_buf_rdy : out std_logic;
last_word : in std_logic;
data : in std_logic_vector(31 downto 0);
wrreq : in std_logic;
rdreq : in std_logic;
rdreq_vec : in std_logic_vector(MAX_OP_WIDTH-1 downto 0) := (others => '0');
q : out std_logic_vector(MAX_OP_WIDTH*33-1 downto 0);
rdreq_rdy : out std_logic;
empty : out std_logic;
full : out std_logic;
overrun : out std_logic;
underrun : out std_logic;
dbl_drop : out std_logic;
fp_drop : out std_logic;
print_data_width : in std_logic_vector( 5 downto 0);
clear_buffer : in std_logic;
start_req : in std_logic;
start_req_first : in std_logic;
start_req_last : in std_logic;
is_last_wave : out std_logic;
fire_req : in std_logic;
sequencers_busy : out std_logic;
fp_holdoff_update : in std_logic;
wave_seq_len : in std_logic_vector(15 downto 0);
all_on : in std_logic := '0';
-- Diagnostic port to peek into pixel buffers, available when EN_PEEK is true.
-- Must only be used when buffer idle (i.e. no fire_req pulses) else output data
-- could be corrupted, although internal state and buffer values remain correct.
diag_peek_sel : in std_logic := '0';
diag_peek_addr : in std_logic_vector(31 downto 0) := (others => '0');
diag_peek_data : out std_logic_vector(31 downto 0);
diag_peek_rdptr : out std_logic_vector( 7 downto 0);
diag_peek_wrptr : out std_logic_vector( 7 downto 0);
diag_peek_wdata : in std_logic_vector(31 downto 0) := (others => '1');
diag_peek_wr : in std_logic := '0';
ip_id_ip_number : out std_logic_vector( 7 downto 0) := 8x"1c"; -- @suppress "Unused port: ip_id_ip_number is not used in work.pixel_buffer_0(rtl)"
ip_id_mfr_number : out std_logic_vector( 7 downto 0) := 8x"00"; -- @suppress "Unused port: ip_id_mfr_number is not used in work.pixel_buffer_0(rtl)"
ip_ver_minor_number : out std_logic_vector( 7 downto 0) := 8x"07"; -- @suppress "Unused port: ip_ver_minor_number is not used in work.pixel_buffer_0(rtl)"
ip_ver_major_number : out std_logic_vector( 7 downto 0) := 8x"00"; -- @suppress "Unused port: ip_ver_major_number is not used in work.pixel_buffer_0(rtl)"
diag_word_count : out std_logic_vector(6 downto 0)
);
end pixel_buffer_1;
architecture rtl of pixel_buffer_1 is
constant PX_DEPTH_LOG2 : integer := log2(PX_DEPTH);
constant TOTAL_DEPTH_LOG2 : integer := log2(PX_DEPTH + RSVD_DEPTH);
constant PX_WIDTH : integer := 33;
constant FULL_THRESHOLD : integer := PX_DEPTH-FULL_MARGIN;
subtype OP_WIDTH_RANGE is natural range 1 to MAX_OP_WIDTH;
type rd_ptr_t is array (natural range <> ) of std_logic_vector;
signal wr_ptr : std_logic_vector(PX_DEPTH_LOG2 downto 0);
signal wr_ptr_int : std_logic_vector(TOTAL_DEPTH_LOG2 downto 0);
signal rd_ptr : rd_ptr_t(0 to MAX_OP_WIDTH-1)(PX_DEPTH_LOG2 downto 0);
signal rd_ptr_int : rd_ptr_t(0 to MAX_OP_WIDTH-1)(TOTAL_DEPTH_LOG2 downto 0);
signal rd_ptr_start : std_logic_vector(PX_DEPTH_LOG2 downto 0);
signal wr_ptr_start : std_logic_vector(PX_DEPTH_LOG2 downto 0);
signal wr_ptr_plus1 : std_logic_vector(PX_DEPTH_LOG2 downto 0);
signal buf_word_count : std_logic_vector(PX_DEPTH_LOG2 downto 0);
signal pixel_buf_wr_shft : std_logic_vector(MAX_OP_WIDTH-1 downto 0);
signal wren : std_logic_vector(MAX_OP_WIDTH-1 downto 0);
signal wren_int : std_logic_vector(MAX_OP_WIDTH-1 downto 0);
signal word_count : std_logic_vector(PX_DEPTH_LOG2 downto 0);
signal word_wrap : std_logic_vector(PX_DEPTH_LOG2 downto 0);
signal word_wrap_plus1 : std_logic_vector(PX_DEPTH_LOG2 downto 0);
signal error : std_logic;
signal pend_drop_detect : std_logic;
signal drop_adjust : std_logic_vector(PX_DEPTH_LOG2 downto 0);
signal next_drop_adjust : std_logic_vector(PX_DEPTH_LOG2 downto 0);
signal holdoff_count : std_logic_vector(15 downto 0);
signal next_sequencers_busy : std_logic;
signal fire_drop_detect : std_logic;
signal wr_req_int : std_logic;
signal data_int : std_logic_vector(32 downto 0);
signal writing_first_stripe : std_logic;
signal diag_peek_wren : std_logic_vector(MAX_OP_WIDTH-1 downto 0);
signal is_en_peek : std_logic;
signal rdreq_vec_int : std_logic_vector(MAX_OP_WIDTH-1 downto 0);
signal all_on_active : std_logic;
begin
-- -----------------------------------------------
-- Simulation assertion checks
-- -----------------------------------------------
-- pragma translate_off
assert FULL_MARGIN < PX_DEPTH report "FULL_MARGIN must be < PX_DEPTH" severity failure;
-- Assert that the pixel buffer is depth is a power of 2
process(all)
variable vp : unsigned(31 downto 0);
variable vpm1 : unsigned(31 downto 0);
begin
vp := to_unsigned(PX_DEPTH, 32);
vpm1 := to_unsigned(PX_DEPTH-1, 32);
assert (vp and vpm1) = 0 report "PX_DEPTH must be a power of 2" & integer'image(PX_DEPTH) severity failure;
end process;
-- pragma translate_on
-- -----------------------------------------------
-- Vectored read request selection
-- -----------------------------------------------
GEN_RDREQ_VEC : if VECTORED_RDREQ generate
rdreq_vec_int <= rdreq_vec;
end generate;
GEN_NORDREQ_VEC : if not VECTORED_RDREQ generate
rdreq_vec_int <= (others => rdreq);
end generate;
-- -----------------------------------------------
-- Pixel Buffers
-- -----------------------------------------------
GEN_PIXEL_BUFFERS : for i in 0 to MAX_OP_WIDTH-1 generate
wren(i) <= pixel_buf_wr_shft(i) when wr_req_int = '1' else '0';
wren_int(i) <= wren(i) or diag_peek_wren(i);
pixel_ram_inst : entity work.dp_ram_1
generic map (
DEPTH => PX_DEPTH + RSVD_DEPTH,
DATA_WIDTH => PX_WIDTH,
REGISTER_OUTPUT => "UNREGISTERED",
READ_WRITE_MODE => "DONT_CARE",
DEVICE_FAMILY => DEVICE_FAMILY
)
port map
(
clk => clk,
wrdata => data_int,
rdaddr => rd_ptr_int(i)(TOTAL_DEPTH_LOG2-1 downto 0),
wraddr => wr_ptr_int(TOTAL_DEPTH_LOG2-1 downto 0),
wren => wren_int(i),
rddata => q((i+1)*PX_WIDTH-1 downto i*PX_WIDTH)
);
end generate GEN_PIXEL_BUFFERS;
-- -----------------------------------------------
-- Combo logic
-- -----------------------------------------------
word_wrap_plus1 <= std_logic_vector(unsigned(word_wrap)+1);
empty <= '1' when unsigned(word_count) = 0 else '0';
full <= '1' when unsigned(word_count) >= FULL_THRESHOLD else '0';
writing_first_stripe <= '1' when ((unsigned(word_count) = unsigned(word_wrap_plus1)) and pixel_buf_wr_shft(0) = '0') or
((unsigned(word_count) < unsigned(word_wrap_plus1)) and wren(0) = '1') or
empty = '1'
else '0';
-- Flag that data is ready for reading either when not empty, or if in all on mode and 'last' not active
rdreq_rdy <= not empty or (all_on_active and not is_last_wave);
-- Combine the error statuses
error <= underrun or overrun or dbl_drop;
-- Pixel buffer is ready for more write data if not full or not in an error state
pixel_buf_rdy <= not full and not error;
-- Single source of write pointer + 1, used in multiple places
wr_ptr_plus1 <= std_logic_vector(unsigned(wr_ptr) + 1);
-- Word count wrap BPP3 (packed to 4) => 15 for depth of 128)
word_wrap <= std_logic_vector(to_unsigned((4*SHIFT_DEPTH/32)-1,PX_DEPTH_LOG2+1));
-- The pixel buffer droppy deletion count is a function of the number of words
-- in the shift: e.g. 64 bits = 8, 96 bits = 12, 128 bits = 16 etc.
next_drop_adjust <= std_logic_vector(to_unsigned((4*SHIFT_DEPTH/32),PX_DEPTH_LOG2+1));
next_sequencers_busy <= '1' when unsigned(holdoff_count) /= 0 else '0';
fire_drop_detect <= '1' when fire_req = '1' and sequencers_busy = '1' else '0';
diag_word_count <= word_count(diag_word_count'left downto 0);
-- -----------------------------------------------
-- Diagnostic peek combo logic
-- -----------------------------------------------
-- If pixel buffer peeking enabled, then mux the read pointer
-- to the buffers with diag address
GENPK : if EN_PEEK generate
is_en_peek <= '1';
GEN_RDPTR_INT : for i in 0 to MAX_OP_WIDTH-1 generate
rd_ptr_int(i) <= "0" & all_on & rd_ptr(i)(PX_DEPTH_LOG2-1 downto 0) when diag_peek_sel = '0' else
"0" & diag_peek_addr(TOTAL_DEPTH_LOG2-1 downto 0);
end generate;
wr_ptr_int <= std_logic_vector(resize(unsigned(wr_ptr(PX_DEPTH_LOG2-1 downto 0)), TOTAL_DEPTH_LOG2+1)) when unsigned(diag_peek_wren) = 0 else
"0" & diag_peek_addr(TOTAL_DEPTH_LOG2-1 downto 0);
end generate;
-- When no buffer peeking, use only the calculatrated read address
GENNOPL : if not EN_PEEK generate
is_en_peek <= '0';
GEN_RDPTR_INT : for i in 0 to MAX_OP_WIDTH-1 generate
rd_ptr_int(i) <= std_logic_vector(resize(unsigned(rd_ptr(i)(PX_DEPTH_LOG2-1 downto 0)), TOTAL_DEPTH_LOG2+1));
end generate;
wr_ptr_int <= std_logic_vector(resize(unsigned(wr_ptr(PX_DEPTH_LOG2-1 downto 0)), TOTAL_DEPTH_LOG2+1));
end generate;
-- -----------------------------------------------
-- Synchronous process
-- -----------------------------------------------
PX_BUF_CTRL : process(rst_n, clk) is
variable op_width : OP_WIDTH_RANGE;
begin
if rst_n = '0' then
for i in 0 to MAX_OP_WIDTH-1 loop
rd_ptr(i) <= (others => '0');
end loop;
rd_ptr_start <= (others => '0');
wr_ptr_start <= (others => '0');
wr_ptr <= (others => '0');
buf_word_count <= (others => '0');
pixel_buf_wr_shft(pixel_buf_wr_shft'length-1 downto 1) <= (others => '0');
pixel_buf_wr_shft(0) <= '1';
word_count <= (others => '0');
is_last_wave <= '0';
overrun <= '0';
underrun <= '0';
pend_drop_detect <= '0';
dbl_drop <= '0';
fp_drop <= '0';
holdoff_count <= (others => '0');
sequencers_busy <= '0';
wr_req_int <= '0';
all_on_active <= '0';
diag_peek_wren <= (others => '0');
elsif clk'event and clk = '1' then
wr_req_int <= wrreq;
data_int <= last_word & data;
diag_peek_wren <= (others => '0');
if clear_buffer = '1' then
for i in 0 to MAX_OP_WIDTH-1 loop
rd_ptr(i) <= (others => '0');
end loop;
rd_ptr_start <= (others => '0');
wr_ptr_start <= (others => '0');
wr_ptr <= (others => '0');
buf_word_count <= (others => '0');
pixel_buf_wr_shft(pixel_buf_wr_shft'length-1 downto 1) <= (others => '0');
pixel_buf_wr_shft(0) <= '1';
word_count <= (others => '0');
is_last_wave <= '0';
overrun <= '0';
underrun <= '0';
pend_drop_detect <= '0';
dbl_drop <= '0';
fp_drop <= '0';
all_on_active <= '0';
end if;
if fp_holdoff_update = '1' then
holdoff_count <= wave_seq_len;
elsif unsigned(holdoff_count) /= 0 then
holdoff_count <= std_logic_vector(unsigned(holdoff_count) - 1);
end if;
sequencers_busy <= next_sequencers_busy;
-- Register the droppy adjust count to relieve timing
drop_adjust <= next_drop_adjust;
-- On the start request from the print data sequencer, when first
-- (i.e. first in multi-wave grey level, or just a single binary)
-- store the start of the next stripe data. If not first, reset the
-- read pointer to the beginning of the stripe for the subsequent
-- grey level mapping and waveform.
if start_req = '1' and error = '0' then
-- When in normal mode on first start request save off start position of read pointer
-- otherwise reset to last saved place.
if all_on = '0' then
if start_req_first = '1' and all_on_active = '0' then
rd_ptr_start <= rd_ptr(0);
else
for i in 0 TO MAX_OP_WIDTH-1 loop
rd_ptr(i) <= rd_ptr_start;
end loop;
end if;
all_on_active <= '0';
-- If in all on mode increment the saved start position by a stripe if last flag set,
-- else leave it untouched. Read pointers get reset.
else
if start_req_last = '1' then
rd_ptr_start <= std_logic_vector(unsigned(rd_ptr_start) + unsigned(rd_ptr(0)));
end if;
if start_req_first = '1' then
for i in 0 TO MAX_OP_WIDTH-1 loop
rd_ptr(i) <= (others => '0');
end loop;
end if;
all_on_active <= '1';
end if;
-- When the start of the last wave (which could also be the first), latch
-- state to indicate this for the whole transfer.
if start_req_last = '1' then
is_last_wave <= '1';
else
is_last_wave <= '0';
end if;
end if;
-- If pixel buffer peeking diags enabled, export the read and write pointers,
-- being careful as the diag port is fixed width but rd_ptr is defined by generic
-- Note that this will zero-pad or truncate depending on which vector is longer. It's only for diagnostic purposes.
diag_peek_rdptr <= (others => '0');
if is_en_peek then
diag_peek_rdptr <= std_logic_vector(resize(unsigned(rd_ptr(0)), diag_peek_rdptr'length));
end if;
diag_peek_wrptr <= (others => '0');
if is_en_peek then
diag_peek_wrptr <= std_logic_vector(resize(unsigned(wr_ptr), diag_peek_wrptr'length));
end if;
-- Increment the read pointer for each read request
for i in 0 TO MAX_OP_WIDTH-1 loop
if rdreq_vec_int(i) = '1' and error = '0' then
rd_ptr(i) <= std_logic_vector(unsigned(rd_ptr(i)) + 1);
end if;
end loop;
-- Select the read data to peek, based on the address bits beyond the buffer space.
-- If writing, overwrite the RAM data an pulse the selected buffer's write enable.
for i in 0 to MAX_OP_WIDTH-1 loop
if is_en_peek = '1' and i = unsigned(diag_peek_addr(log2(MAX_OP_WIDTH) + TOTAL_DEPTH_LOG2 - 1 downto TOTAL_DEPTH_LOG2)) then
diag_peek_data <= q((i+1)*PX_WIDTH-2 downto i*PX_WIDTH);
if diag_peek_wr = '1' and diag_peek_sel = '1' then
data_int <= "0" & diag_peek_wdata;
diag_peek_wren(i) <= '1';
end if;
end if;
end loop;
-- Update buffer input state when ever we get a strobe
if wr_req_int = '1' and error = '0' then
-- If the buffer 32 bit word count reached 4*SHIFT_DEPTH/32-1, then rollover to 0
if buf_word_count = word_wrap then
buf_word_count <= (others => '0');
-- At rollover, move writes on to the next buffer. The shift register
-- feedback is from the top bit for the configured output width
op_width := to_integer(unsigned(print_data_width));
pixel_buf_wr_shft <= pixel_buf_wr_shft(pixel_buf_wr_shft'length-2 downto 0) & pixel_buf_wr_shft(op_width - 1);
-- if moving on to the next buffer, reset the write pointer to the last start address
if pixel_buf_wr_shft(op_width - 1) /= '1' then
wr_ptr <= wr_ptr_start;
else
-- If about to wrap to the next stripe, update the saved wr_ptr to
-- the next word, and allow the wr_ptr to advance
wr_ptr_start <= wr_ptr_plus1;
wr_ptr <= wr_ptr_plus1;
end if;
--
else
-- Whilst writing data to the active buffer, increment the word count and write pointer
buf_word_count <= std_logic_vector(unsigned(buf_word_count) + 1);
wr_ptr <= wr_ptr_plus1;
end if;
end if;
-- Keep a count, for buffer 0, of the number of words in the buffer.
-- Increment count when written, and decrement when read during the
-- the last wave pulse, but leave static if reading (last pulse) and
-- writing, or neither reading during last pulse nor writing.
if error = '0' then
if wren(0) = '1' and (rdreq_vec_int(0) = '0' or is_last_wave = '0') then
word_count <= std_logic_vector(unsigned(word_count) + 1);
elsif wren(0) = '0' and rdreq_vec_int(0) = '1' and is_last_wave = '1' then
word_count <= std_logic_vector(unsigned(word_count) - 1);
end if;
end if;
--
if unsigned(word_count) = PX_DEPTH and wr_req_int = '1' then
overrun <= '1';
end if;
if writing_first_stripe = '1' and rdreq_vec_int(0) = '1' then
underrun <= not all_on or is_last_wave;
end if;
-- If a drop of a fire pulse is detected, remember that here
if fire_drop_detect = '1' then
fp_drop <= '1';
if pend_drop_detect = '1' then
dbl_drop <= '1';
end if;
pend_drop_detect <= '1';
end if;
-- If a 'droppy' situation is outstanding, wait for the data path to go idle
-- and clear the contents of the next stripe
if pend_drop_detect = '1' and sequencers_busy = '0' and unsigned(wren) = 0 and word_count >= drop_adjust and unsigned(rdreq_vec_int) = 0 then
pend_drop_detect <= '0';
for i in 0 to MAX_OP_WIDTH-1 loop
rd_ptr(i) <= std_logic_vector(unsigned(rd_ptr(i)) + unsigned(drop_adjust));
end loop;
word_count <= std_logic_vector(unsigned(word_count) - unsigned(drop_adjust));
end if;
end if;
end process;
end architecture;

View file

@ -0,0 +1,10 @@
library ieee;
use ieee.std_logic_1164.all;
package pixel_buffer_1_pkg is
type data_array_t is array (natural range <>) of std_logic_vector;
end package;

View file

@ -0,0 +1,367 @@
-------------------------------------------------------------------------------
--! @file
--! @brief SOM FPGA pixel buffer zero gap
--!
--! @details This block is the data core dual channel pixel buffer wrapper for
--! PD inline merging support.
--! for CF3.
--!
--! @b Clock/resets:
--! @li clk : nominally 100MHz
--! @li rst_n : active low reset for clk (asynchronous assert)
--!
--! @b Interfaces:
--! @li pixel_buf_rdy : Ready status output towards print streamer
--! @li data : pixel data from print streamer
--! @li last_word : Flag input indicating data is the last word of an image's stripes
--! @li all_on : ALL ON mode input
--! @li wrreq : buffer write request from print streamer
--! @li q : pixel read data to GL remapper
--! @li rdreq : pixel read request from GL remapper
--! @li empty : buffer empty status.
--! @li full : buffer full (with look-ahead) status
--! @li overrun : Pixel buffer overrun error status
--! @li underrun : Pixel buffer underrun error status
--! @li fp_drop : Fire pulse drop seen
--! @li dbl_drop : Double fire pulse 'droppy' error status
--! @li overlap_error : Merge overlap error status
--! @li en_dual_data_path : Enable dual data path for zero gap
--! @li print_data_width : print output data width (6 or 18 for GMA)
--! @li clear_buffer : Pixel buffer clear pulse input
--! @li start_req : start request pulse from print data sequencer, via delay queue
--! @li start_req_first : start request first wave/next stripe status from print data sequencer, via delay queue
--! @li start_req_last : start request last wave status from print data sequencer, via delay queue
--! @li fire_req* : Fire pulse request inputs
--! @li sequencers_busy : Status output indicating sequences busy with respect to accepting a new fire pulse
--! @li fp_holdoff_update : Strobe input to indicate valid holdoff data (wave sequence length)
--! @li wave_seq_len : Wave sequence length input, in clock cycles for fire request holdoff
--! @li diag_peek_* : Diagnostic buffer read and write peek and poke interface (enabled on EN_PEEK generic)
--!
--! @b Clock-crossing considerations:
--! @li Module is a single clock domain synchronous block
--!
--! @b Language build standard requirements:
--! @li VHDL 2008
--!
--! @author Simon Southwell
--! @copyright (c) 2020 Global Inkjet Systems
--! @date 2020-4-12
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
use work.common_pkg.all;
use work.pixel_buffer_1_pkg.all;
entity pixel_buffer_zero_gap_1 IS
generic (
MAX_OP_WIDTH : natural range 1 to 48 := 4;
SHIFT_DEPTH : integer range 1 to 1024 := 324;
PX_DEPTH : integer range 1 to 1024 := 128;
RSVD_DEPTH : integer range 0 to 1024 := 0;
NUM_CHANS : integer range 1 to 4 := 2;
NO_ZERO_GAP : boolean := false;
EN_PEEK : boolean := false;
DEVICE_FAMILY : string := "Cyclone V" -- "Cyclone 10 LP"
);
port
(
clk : in std_logic;
rst_n : in std_logic;
pixel_buf_rdy : out std_logic_vector(NUM_CHANS-1 downto 0);
last_word : in std_logic_vector(NUM_CHANS-1 downto 0);
data : in data_array_t(NUM_CHANS-1 downto 0)(31 downto 0);
wrreq : in std_logic_vector(NUM_CHANS-1 downto 0);
rdreq : in std_logic;
rdreq_rdy : out std_logic;
q : out data_array_t(NUM_CHANS-1 downto 0)(MAX_OP_WIDTH*32-1 downto 0);
empty : out std_logic;
full : out std_logic;
overrun : out std_logic;
underrun : out std_logic;
dbl_drop : out std_logic;
fp_drop : out std_logic;
overlap_error : out std_logic;
en_dual_data_path : in std_logic;
print_data_width : in std_logic_vector( 5 downto 0);
clear_buffer : in std_logic;
start_req : in std_logic;
start_req_first : in std_logic;
start_req_last : in std_logic;
fire_req : in std_logic;
fire_req_start_merge : in std_logic;
sequencers_busy : out std_logic;
px_buf_ch_nactive : out std_logic_vector(NUM_CHANS-1 downto 0);
fp_holdoff_update : in std_logic;
wave_seq_len : in std_logic_vector(15 downto 0);
all_on : in std_logic;
diag_peek_sel : in std_logic;
diag_peek_addr : in std_logic_vector(31 downto 0);
diag_peek_data : out std_logic_vector(31 downto 0);
diag_peek_rdptr : out std_logic_vector( 7 downto 0);
diag_peek_wrptr : out std_logic_vector( 7 downto 0);
diag_peek_wdata : in std_logic_vector(31 downto 0);
diag_peek_wr : in std_logic;
diag_fire_req_count : out data_array_t(NUM_CHANS-1 downto 0)(31 downto 0);
diag_fire_simg_count : out data_array_t(NUM_CHANS-1 downto 0)(31 downto 0);
diag_last_stripe_count : out data_array_t(NUM_CHANS-1 downto 0)(31 downto 0);
diag_word_count : out std_logic_vector(6 downto 0)
);
end pixel_buffer_zero_gap_1;
architecture rtl of pixel_buffer_zero_gap_1 is
constant TOTAL_DEPTH_LOG2 : integer := log2(PX_DEPTH + RSVD_DEPTH);
constant NUM_CHANS_LOG2 : integer := log2(NUM_CHANS);
constant MAX_OP_WIDTH_LOG2 : integer := log2(MAX_OP_WIDTH);
signal rd_req_int : std_logic_vector(NUM_CHANS-1 downto 0);
signal rd_req_rdy_int : std_logic_vector(NUM_CHANS-1 downto 0);
signal empty_int : std_logic_vector(NUM_CHANS-1 downto 0);
signal full_int : std_logic_vector(NUM_CHANS-1 downto 0);
signal overrun_int : std_logic_vector(NUM_CHANS-1 downto 0);
signal underrun_int : std_logic_vector(NUM_CHANS-1 downto 0);
signal dbl_drop_int : std_logic_vector(NUM_CHANS-1 downto 0);
signal fp_drop_int : std_logic_vector(NUM_CHANS-1 downto 0);
signal sequencers_busy_int : std_logic_vector(NUM_CHANS-1 downto 0);
signal start_req_int : std_logic_vector(NUM_CHANS-1 downto 0);
signal buf_active : std_logic_vector(NUM_CHANS-1 downto 0);
signal buf_active_int : std_logic_vector(NUM_CHANS-1 downto 0);
signal buf_active_dly : std_logic_vector(NUM_CHANS-1 downto 0);
signal master_buf : std_logic_vector(NUM_CHANS-1 downto 0);
signal clr_buf_active : std_logic_vector(NUM_CHANS-1 downto 0);
signal is_last_wave : std_logic_vector(NUM_CHANS-1 downto 0);
signal fire_req_dly : std_logic;
signal rd_data : data_array_t(NUM_CHANS-1 downto 0)(MAX_OP_WIDTH*33-1 downto 0);
signal last_stripe : data_array_t(NUM_CHANS-1 downto 0)(MAX_OP_WIDTH-1 downto 0);
signal diag_word_count_int : data_array_t(NUM_CHANS-1 downto 0)(6 downto 0);
signal diag_peek_data_int : data_array_t(NUM_CHANS-1 downto 0)(31 downto 0);
signal diag_peek_rdptr_int : data_array_t(NUM_CHANS-1 downto 0)( 7 downto 0);
signal diag_peek_wrptr_int : data_array_t(NUM_CHANS-1 downto 0)( 7 downto 0);
signal is_zero_gap : std_logic;
begin
-- -----------------------------------------------
-- Combinatorial logic
-- -----------------------------------------------
-- Select source of diagnostic peek interfaces returned data
diag_peek_data <= diag_peek_data_int(to_integer(unsigned(diag_peek_addr(MAX_OP_WIDTH_LOG2+NUM_CHANS_LOG2 + TOTAL_DEPTH_LOG2 -1 downto MAX_OP_WIDTH+TOTAL_DEPTH_LOG2))));
diag_peek_rdptr <= diag_peek_rdptr_int(to_integer(unsigned(diag_peek_addr(MAX_OP_WIDTH_LOG2+NUM_CHANS_LOG2 + TOTAL_DEPTH_LOG2 -1 downto MAX_OP_WIDTH+TOTAL_DEPTH_LOG2))));
diag_peek_wrptr <= diag_peek_wrptr_int(to_integer(unsigned(diag_peek_addr(MAX_OP_WIDTH_LOG2+NUM_CHANS_LOG2 + TOTAL_DEPTH_LOG2 -1 downto MAX_OP_WIDTH+TOTAL_DEPTH_LOG2))));
-- Amalgamate the read interface signals
rd_req_int <= rdreq & rdreq and buf_active_int; -- @suppress "Incorrect array size in assignment: expected NUM_CHANS but was 2"
rdreq_rdy <= '1' when unsigned(rd_req_rdy_int) /= 0 else '0';
px_buf_ch_nactive <= not buf_active_int;
-- Amalgamate the status signals
empty <= '1' when unsigned(not empty_int) = 0 else '0';
full <= '1' when unsigned(full_int) /= 0 else '0';
overrun <= '1' when unsigned(overrun_int) /= 0 else '0';
underrun <= '1' when unsigned(underrun_int) /= 0 else '0';
dbl_drop <= '1' when unsigned(dbl_drop_int) /= 0 else '0';
fp_drop <= '1' when unsigned(fp_drop_int) /= 0 else '0';
sequencers_busy <= '1' when unsigned(sequencers_busy_int) /= 0 else '0';
buf_active_int <= buf_active when en_dual_data_path = '1' else std_logic_vector(to_unsigned(1, NUM_CHANS));
-- Tie off unused signals when no zero gap enabled
GEN_IS_NOT_ZG : if NO_ZERO_GAP generate
is_zero_gap <= '0';
empty_int(NUM_CHANS-1 downto 1) <= (others => '1');
full_int(NUM_CHANS-1 downto 1) <= (others => '0');
overrun_int(NUM_CHANS-1 downto 1) <= (others => '0');
underrun_int(NUM_CHANS-1 downto 1) <= (others => '0');
dbl_drop_int(NUM_CHANS-1 downto 1) <= (others => '0');
fp_drop_int(NUM_CHANS-1 downto 1) <= (others => '0');
sequencers_busy_int(NUM_CHANS-1 downto 1) <= (others => '0');
pixel_buf_rdy(NUM_CHANS-1 downto 1) <= (others => '0');
diag_peek_rdptr_int(NUM_CHANS-1 downto 1) <= (others => (others => '0'));
diag_peek_wrptr_int(NUM_CHANS-1 downto 1) <= (others => (others => '0'));
rd_req_rdy_int(NUM_CHANS-1 downto 1) <= (others => '0');
GEN_TIE_OFF_Q : for i in 1 to NUM_CHANS-1 generate
q(i) <= (others => '0');
end generate;
end generate;
-- Flag when zero gap is enabled
GEN_IS_ZG : if NO_ZERO_GAP = false generate
is_zero_gap <= '1';
end generate;
-- -----------------------------------------------
-- Instantiate the pixel buffers, both normal and
-- (if enabled) auxiliary
-- -----------------------------------------------
GEN_PX_BUF : for i in 0 to NUM_CHANS-1 generate
GEN_NO_ZG : if i = 0 or NO_ZERO_GAP = false generate
start_req_int(i) <= buf_active_int(i) and start_req;
GEN_Q : for j in 0 to MAX_OP_WIDTH-1 generate
q(i)(j*32+31 downto j*32) <= rd_data(i)(j*33+31 downto j*33) when buf_active_int(i) else (others => '0');
last_stripe(i)(j downto j) <= rd_data(i)(j*33+32 downto j*33+32);
end generate;
clr_buf_active(i) <= last_stripe(i)(MAX_OP_WIDTH-1) and is_last_wave(i) and rd_req_int(i);
pixel_buf_inst : entity work.pixel_buffer_1
generic map (
MAX_OP_WIDTH => MAX_OP_WIDTH,
SHIFT_DEPTH => SHIFT_DEPTH,
PX_DEPTH => PX_DEPTH,
RSVD_DEPTH => RSVD_DEPTH,
EN_PEEK => EN_PEEK,
DEVICE_FAMILY => DEVICE_FAMILY
)
port map
(
clk => clk,
rst_n => rst_n,
pixel_buf_rdy => pixel_buf_rdy(i),
last_word => last_word(i),
data => data(i),
wrreq => wrreq(i),
rdreq => rd_req_int(i),
rdreq_rdy => rd_req_rdy_int(i),
q => rd_data(i),
empty => empty_int(i),
full => full_int(i),
overrun => overrun_int(i),
underrun => underrun_int(i),
dbl_drop => dbl_drop_int(i),
fp_drop => fp_drop_int(i),
print_data_width => print_data_width,
clear_buffer => clear_buffer,
start_req => start_req_int(i),
start_req_first => start_req_first,
start_req_last => start_req_last,
is_last_wave => is_last_wave(i),
all_on => all_on,
diag_peek_sel => diag_peek_sel,
diag_peek_addr => diag_peek_addr,
diag_peek_data => diag_peek_data_int(i),
diag_peek_rdptr => diag_peek_rdptr_int(i),
diag_peek_wrptr => diag_peek_wrptr_int(i),
diag_peek_wdata => diag_peek_wdata,
diag_peek_wr => diag_peek_wr,
fire_req => fire_req,
sequencers_busy => sequencers_busy_int(i),
fp_holdoff_update => fp_holdoff_update,
wave_seq_len => wave_seq_len,
diag_word_count => diag_word_count_int(i)
);
end generate;
end generate;
diag_word_count <= diag_word_count_int(0);
-- -----------------------------------------------
-- synchronous process to swing between buffers
-- in zero gap mode
-- -----------------------------------------------
P_SWING : process(rst_n, clk) is
begin
if rst_n = '0' then
master_buf <= std_logic_vector(to_unsigned(1, NUM_CHANS));
buf_active <= (others => '0');
overlap_error <= '0';
diag_fire_req_count <= (others => (others => '0'));
diag_fire_simg_count <= (others => (others => '0'));
diag_last_stripe_count <= (others => (others => '0'));
fire_req_dly <= '0';
buf_active_dly <= (others => '0');
elsif clk'event and clk = '1' then
buf_active <= buf_active and not clr_buf_active;
fire_req_dly <= fire_req;
buf_active_dly <= buf_active;
if clear_buffer = '1' or overlap_error = '1' then
master_buf <= std_logic_vector(to_unsigned(1, NUM_CHANS));
buf_active <= (others => '0');
overlap_error <= overlap_error and not clear_buffer;
end if;
if clear_buffer = '1' then
diag_fire_req_count <= (others => (others => '0'));
diag_fire_simg_count <= (others => (others => '0'));
diag_last_stripe_count <= (others => (others => '0'));
elsif fire_req_dly = '1' then
for i in 0 to NUM_CHANS-1 loop
if buf_active_int(i) = '1' then
diag_fire_req_count(i) <= std_logic_vector(unsigned(diag_fire_req_count(i)) + 1);
end if;
end loop;
end if;
if fire_req = '1' and fire_req_start_merge = '1' then
if is_zero_gap then
master_buf <= master_buf(NUM_CHANS-2 downto 0) & master_buf(NUM_CHANS-1);
end if;
buf_active <= buf_active or master_buf;
if (master_buf and buf_active) /= std_logic_vector(to_unsigned(0, NUM_CHANS)) then
overlap_error <= en_dual_data_path;
end if;
end if;
for i in 0 to NUM_CHANS-1 loop
if buf_active(i) = '1' and buf_active_dly(i) = '0' then
diag_fire_simg_count(i) <= std_logic_vector(unsigned(diag_fire_simg_count(i)) + 1);
elsif buf_active(i) = '0' and buf_active_dly(i) = '1' then
diag_last_stripe_count(i) <= std_logic_vector(unsigned(diag_last_stripe_count(i)) + 1);
end if;
end loop;
end if;
end process;
end architecture;

View file

@ -21,44 +21,44 @@ use ieee.numeric_std.all;
entity pof_tx_3 is
generic (
DEVICE_FAMILY : string := "Cyclone V"
DEVICE_FAMILY : string := "Cyclone V"
);
port(
reset_n : in std_logic;
clk : in std_logic;
init : in std_logic;
init_done : out std_logic;
pd_in : in std_logic;
print_start : in std_logic := '0';
pof_protocol_version : in std_logic := '0';
inc_pos : in std_logic;
dec_pos : in std_logic;
abs_position : in std_logic_vector(31 downto 0);
tx_data : out std_logic;
-- Avalon MM Interface
avs_address : in std_logic_vector(2 downto 0);
avs_write : in std_logic;
avs_writedata : in std_logic_vector(31 downto 0);
avs_read : in std_logic;
avs_readdata : out std_logic_vector(31 downto 0));
reset_n : in std_logic;
clk : in std_logic;
init : in std_logic;
init_done : out std_logic;
pd_in : in std_logic;
print_start : in std_logic := '0';
pof_protocol_version : in std_logic := '0';
inc_pos : in std_logic;
dec_pos : in std_logic;
abs_position : in std_logic_vector(31 downto 0);
tx_data : out std_logic;
-- Avalon MM Interface
avs_address : in std_logic_vector(2 downto 0);
avs_write : in std_logic;
avs_writedata : in std_logic_vector(31 downto 0);
avs_read : in std_logic;
avs_readdata : out std_logic_vector(31 downto 0));
end entity pof_tx_3;
architecture rtl of pof_tx_3 is
function odd_parity(data : std_logic_vector) return std_logic is
variable parity_bit : std_logic := '1';
variable parity_bit : std_logic := '1';
begin
for n in 0 to data'length - 1 loop
parity_bit := parity_bit xor data(n);
end loop; -- n
return parity_bit;
for n in 0 to data'length - 1 loop
parity_bit := parity_bit xor data(n);
end loop; -- n
return parity_bit;
end function odd_parity;
function bin2gray(bin : std_logic_vector) return std_logic_vector is
variable gray : std_logic_vector(bin'range);
variable gray : std_logic_vector(bin'range);
begin
gray := bin xor ('0' & bin(bin'length - 1 downto 1));
return gray;
gray := bin xor ('0' & bin(bin'length - 1 downto 1));
return gray;
end function bin2gray;
signal rd_event, wr_event, empty, full, tx_ready : std_logic;
@ -88,8 +88,8 @@ architecture rtl of pof_tx_3 is
signal fifo_level, fifo_level_max : std_logic_vector(9 downto 0);
signal tx_data_0, tx_data_1 : std_logic;
signal tx_ready_0, tx_ready_1 : std_logic;
begin
clear <= (not enable) or init_d;
@ -100,76 +100,76 @@ begin
pEVENT_GEN : process(clk)
begin
if (clk = '1' and clk'event) then
init_d <= init;
if (init = '0' and init_d = '1') then
-- set up int_v to create 2 packets with the new toggle_sync value when init set low
init_v <= "1100";
-- start timer so this doesn't get triggered again too soon
-- the local clear will still hapen as that depends on init_d
init_blk_cnt <= init_blocked_period;
else
init_v <= '0' & init_v(3 downto 1);
if (init_blocked = '1') then
init_blk_cnt <= std_logic_vector(unsigned(init_blk_cnt) - 1);
end if;
end if;
if (enable = '0') then
toggle_sync <= '0';
elsif (init = '1' and init_d = '0' and init_blocked = '0') then
-- toggle the bit just when init set high.
toggle_sync <= not toggle_sync;
end if;
if (clk = '1' and clk'event) then
init_d <= init;
if (init = '0' and init_d = '1') then
-- set up int_v to create 2 packets with the new toggle_sync value when init set low
init_v <= "1100";
-- start timer so this doesn't get triggered again too soon
-- the local clear will still hapen as that depends on init_d
init_blk_cnt <= init_blocked_period;
else
init_v <= '0' & init_v(3 downto 1);
if (init_blocked = '1') then
init_blk_cnt <= std_logic_vector(unsigned(init_blk_cnt) - 1);
end if;
end if;
if (enable = '0') then
toggle_sync <= '0';
elsif (init = '1' and init_d = '0' and init_blocked = '0') then
-- toggle the bit just when init set high.
toggle_sync <= not toggle_sync;
end if;
pd_in_d <= pd_in;
pd_event_d <= pd_event;
pd_event_dd <= pd_event_d;
pd_event_ddd <= pd_event_dd;
if (pd_event = '1') then
latched_pos <= abs_position(3 downto 0);
end if;
if ((dec_pos = '1' or inc_pos = '1') and pd_gen = '1') then
delayed_pos_v <= "111";
else
delayed_pos_v <= '0' & delayed_pos_v(2 downto 1);
end if;
if (enable = '0') then
toggle_pd <= '0';
elsif (pd_event = '1') then
toggle_pd <= not toggle_pd;
end if;
if (print_start_src = '0') then
print_start_val <= print_start;
else
print_start_val <= print_start_sw;
end if;
print_start_val_d <= print_start_val;
print_start_event <= print_start_en and (print_start_val xor print_start_val_d);
print_start_event_d <= print_start_event;
wr_event <= wr_event_i or add_keepalive;
event_in <= parity_bit & event_in_i;
if (enable = '0' or wr_event_i = '1') then
keepalive_cnt <= keepalive_period;
else
keepalive_cnt <= std_logic_vector(unsigned(keepalive_cnt) - 1);
end if;
if (clear = '1') then
ovfl_err <= '0';
elsif (wr_event = '1' and full = '1') then
ovfl_err <= '1';
end if;
if (clear = '1' or wr_event = '1') then
inject_error <= '0';
elsif (inject_error_req = '1') then
inject_error <= '1';
end if;
if (clear = '1' or clr_fifo_lmax = '1') then
fifo_level_max <= (others => '0');
elsif (unsigned(fifo_level) > unsigned(fifo_level_max)) then
fifo_level_max <= fifo_level;
end if;
init_done <= not (init_d or init_blocked); -- true only when the init messages have been transmitted (based on timing)
end if;
pd_in_d <= pd_in;
pd_event_d <= pd_event;
pd_event_dd <= pd_event_d;
pd_event_ddd <= pd_event_dd;
if (pd_event = '1') then
latched_pos <= abs_position(3 downto 0);
end if;
if ((dec_pos = '1' or inc_pos = '1') and pd_gen = '1') then
delayed_pos_v <= "111";
else
delayed_pos_v <= '0' & delayed_pos_v(2 downto 1);
end if;
if (enable = '0') then
toggle_pd <= '0';
elsif (pd_event = '1') then
toggle_pd <= not toggle_pd;
end if;
if (print_start_src = '0') then
print_start_val <= print_start;
else
print_start_val <= print_start_sw;
end if;
print_start_val_d <= print_start_val;
print_start_event <= print_start_en and (print_start_val xor print_start_val_d);
print_start_event_d <= print_start_event;
wr_event <= wr_event_i or add_keepalive;
event_in <= parity_bit & event_in_i;
if (enable = '0' or wr_event_i = '1') then
keepalive_cnt <= keepalive_period;
else
keepalive_cnt <= std_logic_vector(unsigned(keepalive_cnt) - 1);
end if;
if (clear = '1') then
ovfl_err <= '0';
elsif (wr_event = '1' and full = '1') then
ovfl_err <= '1';
end if;
if (clear = '1' or wr_event = '1') then
inject_error <= '0';
elsif (inject_error_req = '1') then
inject_error <= '1';
end if;
if (clear = '1' or clr_fifo_lmax = '1') then
fifo_level_max <= (others => '0');
elsif (unsigned(fifo_level) > unsigned(fifo_level_max)) then
fifo_level_max <= fifo_level;
end if;
init_done <= not (init_d or init_blocked); -- true only when the init messages have been transmitted (based on timing)
end if;
end process pEVENT_GEN;
init_gen <= init_v(0);
@ -182,24 +182,24 @@ begin
protocol_ver_sel : process(all) is
begin
if pof_protocol_version = '0' then
if pof_protocol_version = '0' then
print_start_gen <= '0';
event_in_i <= '0' & gray & toggle_pd & toggle_pd & toggle_sync;
symbol <= '0' & event_out(8) & event_out(6 downto 0);
tx_data <= tx_data_0;
tx_ready <= tx_ready_0;
else
-- Two symbols are queued up in the FIFO each time there is a change in value
-- on Print-Start/Stop
print_start_gen <= print_start_event or print_start_event_d;
-- toggle_pd is repeated twice in the tx word, to improve resiliance against
-- double bit-flips errors
event_in_i <= print_start_val & gray & toggle_pd & toggle_pd & toggle_sync;
symbol <= event_out;
tx_data <= tx_data_1;
tx_ready <= tx_ready_1;
end if;
print_start_gen <= '0';
event_in_i <= '0' & gray & toggle_pd & toggle_pd & toggle_sync;
symbol <= '0' & event_out(8) & event_out(6 downto 0);
tx_data <= tx_data_0;
tx_ready <= tx_ready_0;
else
-- Two symbols are queued up in the FIFO each time there is a change in value
-- on Print-Start/Stop
print_start_gen <= print_start_event or print_start_event_d;
-- toggle_pd is repeated twice in the tx word, to improve resiliance against
-- double bit-flips errors
event_in_i <= print_start_val & gray & toggle_pd & toggle_pd & toggle_sync;
symbol <= event_out;
tx_data <= tx_data_1;
tx_ready <= tx_ready_1;
end if;
end process protocol_ver_sel;
delayed_pos <= delayed_pos_v(0) and pd_event_ddd;
@ -212,24 +212,24 @@ begin
parity_bit <= odd_parity(event_in_i) xor inject_error;
iQUEUE_EVENT : entity work.sync_fifo
generic map (
DEVICE_FAMILY => DEVICE_FAMILY,
DATA_WIDTH => 9,
DEPTH => 1024,
SHOWAHEAD => "OFF",
REGISTER_OUTPUT => "OFF"
)
port map (
sclr => clear,
clk => clk,
wrdata => event_in,
rdreq => rd_event,
wrreq => wr_event,
empty => empty,
full => full,
rddata => event_out,
usedw => fifo_level);
iQUEUE_EVENT : entity work.sync_fifo_1
generic map (
DEVICE_FAMILY => DEVICE_FAMILY,
DATA_WIDTH => 9,
DEPTH => 1024,
SHOWAHEAD => "OFF",
REGISTER_OUTPUT => "OFF"
)
port map (
sclr => clear,
clk => clk,
wrdata => event_in,
rdreq => rd_event,
wrreq => wr_event,
empty => empty,
full => full,
rddata => event_out,
usedw => fifo_level);
-----------------------------------------------------------------------------
@ -238,78 +238,78 @@ begin
pGET_EVENT : process(clk)
begin
if(clk = '1' and clk'event) then
rd_event_d <= rd_event;
symbol_valid <= rd_event_d;
end if;
if(clk = '1' and clk'event) then
rd_event_d <= rd_event;
symbol_valid <= rd_event_d;
end if;
end process pGET_EVENT;
rd_event <= '1' when tx_ready = '1' and empty = '0' and rd_event_d = '0' and symbol_valid = '0' else '0';
iTX_SYMBOL_pofprotver0 : entity work.uart_tx_3
generic map(
data_width => 8)
port map(
reset_n => reset_n,
clk => clk,
bit_div => bit_div,
init => clear,
ready => tx_ready_0,
data_in => symbol(7 downto 0),
data_valid => symbol_valid,
tx_data => tx_data_0);
generic map(
data_width => 8)
port map(
reset_n => reset_n,
clk => clk,
bit_div => bit_div,
init => clear,
ready => tx_ready_0,
data_in => symbol(7 downto 0),
data_valid => symbol_valid,
tx_data => tx_data_0);
iTX_SYMBOLpofprotver1 : entity work.uart_tx_3
generic map(
data_width => 9)
port map(
reset_n => reset_n,
clk => clk,
bit_div => bit_div,
init => clear,
ready => tx_ready_1,
data_in => symbol,
data_valid => symbol_valid,
tx_data => tx_data_1);
generic map(
data_width => 9)
port map(
reset_n => reset_n,
clk => clk,
bit_div => bit_div,
init => clear,
ready => tx_ready_1,
data_in => symbol,
data_valid => symbol_valid,
tx_data => tx_data_1);
-----------------------------------------------------------------------------
-- C&S registers
-----------------------------------------------------------------------------
pof_tx_csr_regs_inst : entity work.pof_tx_3_csr_regs
generic map(
ADDR_DECODE_WIDTH => 3
)
port map(
-- Clock and reset
clk => clk,
rst_n => reset_n,
-- auto-generated
generic map(
ADDR_DECODE_WIDTH => 3
)
port map(
-- Clock and reset
clk => clk,
rst_n => reset_n,
-- Internal signal ports
control_enable => enable,
control_bit_div => bit_div,
control_print_start_event_gen => print_start_en,
control_print_start_src => print_start_src,
control_print_start_sw => print_start_sw,
timing_keepalive_period => keepalive_period,
timing_init_blocked_period => init_blocked_period,
control_clr_fifo_level_max => clr_fifo_lmax,
error_inject => inject_error_req,
status_ovfl_err => ovfl_err,
status_print_start_val => print_start_val,
fifo_level_fifo_level => fifo_level,
fifo_level_max_fifo_level => fifo_level_max,
-- end auto-generated
-- 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
);
-- Internal signal ports
control_enable => enable,
control_bit_div => bit_div,
control_print_start_event_gen => print_start_en,
control_print_start_src => print_start_src,
control_print_start_sw => print_start_sw,
timing_keepalive_period => keepalive_period,
timing_init_blocked_period => init_blocked_period,
control_clr_fifo_level_max => clr_fifo_lmax,
error_inject => inject_error_req,
status_ovfl_err => ovfl_err,
status_print_start_val => print_start_val,
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
);
end architecture rtl;

View file

@ -57,7 +57,7 @@ begin
wr_ptr <= wr_count(log2(LOGGER_DEPTH)-1 downto 0);
ram_inst : entity work.dp_ram
ram_inst : entity work.dp_ram_1
generic map (
DEPTH => LOGGER_DEPTH,
DATA_WIDTH => 32,

View file

@ -97,7 +97,7 @@ begin
-- ADDRESS/COUNT QUEUE
-- ---------------------------------------
streamer_queue_inst : entity work.sync_fifo
streamer_queue_inst : entity work.sync_fifo_1
generic map(
DATA_WIDTH => 32,
DEPTH => 32,

View file

@ -284,7 +284,7 @@ begin
write_data_parity <= parity;
end process;
read_fifo_inst : entity work.sync_fifo
read_fifo_inst : entity work.sync_fifo_1
generic map(
DATA_WIDTH => DW,
DEPTH => 128,
@ -328,7 +328,7 @@ begin
sniff_strobe <= read_fifo_wr_req;
sniff_data <= read_fifo_wr_data;
write_fifo_inst : entity work.sync_fifo
write_fifo_inst : entity work.sync_fifo_1
generic map(
DATA_WIDTH => DW,
DEPTH => 128,