Added zero gap pixel buffer and preslicer wrappers. Fixed alt_sync_fifo generics for synth (worked for sim)

This commit is contained in:
Simon Southwell 2020-10-12 07:52:07 +01:00
commit 97569af200
3 changed files with 536 additions and 3 deletions

View file

@ -43,10 +43,10 @@ use work.common_pkg.all;
entity alt_sync_fifo is
generic (
DATA_WIDTH : natural range 1 to 256 := 32;
DEPTH : natural range 2 to 131072 := 64;
DEPTH : natural range 1 to 131072 := 64;
REGISTER_OUTPUT : string := "ON"; -- "OFF"
NEARLY_FULL : natural range 1 to DEPTH-1 := DEPTH-2;
NEARLY_EMPTY : natural range 1 to DEPTH-1 := 2;
NEARLY_FULL : natural range 1 to 131072 := 62;
NEARLY_EMPTY : natural range 1 to 131072 := 2;
DEVICE_FAMILY : string := "Cyclone V" ; -- "Cyclone 10 LP"
SHOWAHEAD : string := "ON"; -- "OFF"
CHECKING : string := "ON" -- "OFF"

View file

@ -0,0 +1,364 @@
-------------------------------------------------------------------------------
--! @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_0_pkg.all;
entity pixel_buffer_zero_gap_0 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
);
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_0;
architecture rtl of pixel_buffer_zero_gap_0 is
constant TOTAL_DEPTH_LOG2 : integer := log2(PX_DEPTH + RSVD_DEPTH);
constant NUM_CHANS_LOG2 : integer := log2(NUM_CHANS);
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+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+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+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_0
generic map (
MAX_OP_WIDTH => MAX_OP_WIDTH,
SHIFT_DEPTH => SHIFT_DEPTH,
PX_DEPTH => PX_DEPTH,
RSVD_DEPTH => RSVD_DEPTH,
EN_PEEK => EN_PEEK
)
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

@ -0,0 +1,169 @@
-------------------------------------------------------------------------------
--! @file
--! @brief SOM FPGA preslicer
--!
--! @details This block is the data core dual channel preslicer wrapper.
--!
--! @b Clock/resets:
--! @li clk : nominally 100MHz
--! @li rst_n : active low reset for clk (asynchronous assert)
--!
--! @b Interfaces:
--! @li bpp_mode : the current bits-per-pixel mode (1, 2 or 3---same as 4BPP)
--! @li clear_buffer : Pixel buffer clear pulse input
--! @li ps_buf_wr_data* : print streamer data input
--! @li ps_buf_wr* : Write strobe input for print streamer data
--! @li ps_buf_rdy* : Ready output towards print streamer
--! @li ps_buf_last_word* : input to flag last word of a image's stripes
--! @li pixel_buf_wr_data* : pixel buffer data data output
--! @li pixel_buf_wr* : Write strobe output to pixel buffer
--! @li pixel_buf_rdy : Ready input from pixel buffer
--! @li pixel_buf_last_word : Output flagging last word of an image's stripes
--!
--! @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-04-02
-------------------------------------------------------------------------------
-- altera vhdl_input_version vhdl_2008
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity preslicer_dual_0 is
generic (
NUM_STRIPES_DEPTH : integer range 2 to 32 := 8; -- whole 1bpp equivalent stripes must it be possible to buffer in preslicer
NUM_STRIPES_FULL_MARGIN : integer range 1 to 31 := 2; -- at least this many 1bpp equivalent stripes space must be available
SHIFT_DEPTH : integer range 1 to 2048 := 128; -- head shift buffer depth
MAX_OP_WIDTH : natural range 1 to 128 := 8;
NO_ZERO_GAP : boolean := false
);
port
(
clk : in std_logic;
rst_n : in std_logic;
bpp_mode : in std_logic_vector( 1 downto 0);
clear_buffer : in std_logic;
-- Interface to print streamer
ps_buf_wr : in std_logic;
ps_buf_wr_data : in std_logic_vector(31 downto 0);
ps_buf_rdy : out std_logic;
ps_buf_last_word : in std_logic;
-- Auxiliary print streamer interafce. Used only if mutually
-- exclusive from maininterafce (shared memory port)
ps_buf_wr_aux : in std_logic;
ps_buf_wr_data_aux : in std_logic_vector(31 downto 0);
ps_buf_rdy_aux : out std_logic;
ps_buf_last_word_aux : in std_logic;
-- Output data
pixel_buf_wr_aux : out std_logic;
pixel_buf_wr : out std_logic;
pixel_buf_wr_data : out std_logic_vector(31 downto 0);
pixel_buf_wr_data_aux : out std_logic_vector(31 downto 0);
pixel_buf_rdy : in std_logic_vector( 1 downto 0);
pixel_buf_last_word : out std_logic_vector( 1 downto 0)
);
end preslicer_dual_0;
architecture rtl of preslicer_dual_0 is
type data_array_t is array (0 to 1) of std_logic_vector(31 downto 0);
signal ps_buf_wr_int : std_logic_vector(1 downto 0);
signal ps_buf_wr_data_int : data_array_t;
signal ps_buf_rdy_int : std_logic_vector(1 downto 0);
signal ps_buf_last_word_int : std_logic_vector(1 downto 0);
signal pixel_buf_wr_int : std_logic_vector(1 downto 0);
signal pixel_buf_wr_data_int : data_array_t;
signal pixel_buf_rdy_int : std_logic_vector(1 downto 0);
signal pixel_buf_last_word_int : std_logic_vector(1 downto 0);
begin
ps_buf_wr_int(0) <= ps_buf_wr;
ps_buf_wr_data_int(0) <= ps_buf_wr_data;
ps_buf_rdy <= ps_buf_rdy_int(0);
ps_buf_last_word_int(0) <= ps_buf_last_word;
pixel_buf_wr <= pixel_buf_wr_int(0);
pixel_buf_wr_data <= pixel_buf_wr_data_int(0);
pixel_buf_rdy_int(0) <= pixel_buf_rdy(0);
pixel_buf_last_word(0) <= pixel_buf_last_word_int(0);
GEN_ZG: if not NO_ZERO_GAP generate
ps_buf_wr_int(1) <= ps_buf_wr_aux;
ps_buf_wr_data_int(1) <= ps_buf_wr_data_aux;
ps_buf_last_word_int(1) <= ps_buf_last_word_aux;
ps_buf_rdy_aux <= ps_buf_rdy_int(1);
pixel_buf_wr_aux <= pixel_buf_wr_int(1);
pixel_buf_wr_data_aux <= pixel_buf_wr_data_int(1);
pixel_buf_rdy_int(1) <= pixel_buf_rdy(1);
pixel_buf_last_word(1) <= pixel_buf_last_word_int(1);
end generate;
GEN_NO_ZG_TIE_OFF : if NO_ZERO_GAP generate
ps_buf_wr_int(1) <= '0';
ps_buf_wr_data_int(1) <= (others => '0');
ps_buf_last_word_int(1) <= '0';
ps_buf_rdy_aux <= '0';
pixel_buf_wr_aux <= '0';
pixel_buf_wr_data_aux <= (others => '0');
pixel_buf_rdy_int(1) <= '0';
pixel_buf_last_word(1) <= '0';
end generate;
GEN_PRESLICER : for i in 0 to 1 generate
GEN_NO_ZG : if i = 0 or NO_ZERO_GAP = false generate
preslicer_inst : entity work.preslicer_0
generic map (
NUM_STRIPES_DEPTH => NUM_STRIPES_DEPTH,
NUM_STRIPES_FULL_MARGIN => NUM_STRIPES_FULL_MARGIN,
SHIFT_DEPTH => SHIFT_DEPTH,
MAX_OP_WIDTH => MAX_OP_WIDTH
)
port map
(
clk => clk,
rst_n => rst_n,
bpp_mode => bpp_mode,
clear_buffer => clear_buffer,
ps_buf_wr => ps_buf_wr_int(i),
ps_buf_wr_data => ps_buf_wr_data_int(i),
ps_buf_rdy => ps_buf_rdy_int(i),
ps_buf_last_word => ps_buf_last_word_int(i),
-- Output data
pixel_buf_wr => pixel_buf_wr_int(i),
pixel_buf_wr_data => pixel_buf_wr_data_int(i),
pixel_buf_rdy => pixel_buf_rdy_int(i),
pixel_buf_last_word => pixel_buf_last_word_int(i)
);
end generate;
end generate;
end rtl;