HMBSI1536-36 New minor version pixel_buffer_0 (0x04). Support for independent read requests.
This commit is contained in:
parent
9a60e686ed
commit
d72ef6be00
1 changed files with 188 additions and 161 deletions
|
|
@ -65,97 +65,100 @@ use ieee.numeric_std.all;
|
|||
|
||||
use work.common_pkg.all;
|
||||
|
||||
entity pixel_buffer_0 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;
|
||||
FULL_MARGIN : integer range 2 to 1024 := 8;
|
||||
EN_PEEK : boolean := false
|
||||
entity pixel_buffer_0 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;
|
||||
FULL_MARGIN : integer range 2 to 1024 := 8;
|
||||
EN_PEEK : boolean := false;
|
||||
VECTORED_RDREQ : boolean := false
|
||||
);
|
||||
port
|
||||
(
|
||||
clk : in std_logic;
|
||||
rst_n : in std_logic;
|
||||
clk : in std_logic;
|
||||
rst_n : in std_logic;
|
||||
|
||||
pixel_buf_rdy : out 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;
|
||||
last_word : in std_logic;
|
||||
data : in std_logic_vector(31 downto 0);
|
||||
wrreq : in std_logic;
|
||||
|
||||
rdreq : in std_logic;
|
||||
q : out std_logic_vector(MAX_OP_WIDTH * 33 - 1 downto 0);
|
||||
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);
|
||||
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
start_req : in std_logic;
|
||||
start_req_first : in std_logic;
|
||||
start_req_last : in std_logic;
|
||||
|
||||
is_last_wave : out 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);
|
||||
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);
|
||||
|
||||
-- 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_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);
|
||||
|
||||
ip_id_ip_number : out std_logic_vector(7 downto 0) := 8x"1c";
|
||||
ip_id_mfr_number : out std_logic_vector(7 downto 0) := 8x"00";
|
||||
ip_ver_minor_number : out std_logic_vector(7 downto 0) := 8x"03";
|
||||
ip_ver_major_number : out std_logic_vector(7 downto 0) := 8x"00";
|
||||
ip_id_ip_number : out std_logic_vector( 7 downto 0) := 8x"1c";
|
||||
ip_id_mfr_number : out std_logic_vector( 7 downto 0) := 8x"00";
|
||||
ip_ver_minor_number : out std_logic_vector( 7 downto 0) := 8x"04";
|
||||
ip_ver_major_number : out std_logic_vector( 7 downto 0) := 8x"00";
|
||||
|
||||
diag_word_count : out std_logic_vector(6 downto 0)
|
||||
diag_word_count : out std_logic_vector(6 downto 0)
|
||||
);
|
||||
end pixel_buffer_0;
|
||||
|
||||
|
||||
architecture rtl of pixel_buffer_0 is
|
||||
|
||||
constant PX_DEPTH_LOG2 : integer := log2(PX_DEPTH);
|
||||
constant PX_WIDTH : integer := 33;
|
||||
constant FULL_THRESHOLD : integer := PX_DEPTH - FULL_MARGIN;
|
||||
constant PX_DEPTH_LOG2 : integer := log2(PX_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;
|
||||
subtype OP_WIDTH_RANGE is natural range 1 to MAX_OP_WIDTH;
|
||||
|
||||
type diag_array_t is array (natural range <> ) of std_logic_vector;
|
||||
type rd_ptr_t is array (0 to MAX_OP_WIDTH-1) of std_logic_vector(PX_DEPTH_LOG2 downto 0);
|
||||
|
||||
type diag_array_t is array (natural range <>) of std_logic_vector;
|
||||
signal wr_ptr : std_logic_vector(PX_DEPTH_LOG2 downto 0);
|
||||
signal rd_ptr : rd_ptr_t;
|
||||
signal rd_ptr_int : rd_ptr_t;
|
||||
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 wr_ptr : std_logic_vector(PX_DEPTH_LOG2 downto 0);
|
||||
signal rd_ptr : std_logic_vector(PX_DEPTH_LOG2 downto 0);
|
||||
signal rd_ptr_int : std_logic_vector(PX_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 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 word_count : std_logic_vector(PX_DEPTH_LOG2 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 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 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;
|
||||
|
|
@ -165,131 +168,149 @@ architecture rtl of pixel_buffer_0 is
|
|||
signal data_int : std_logic_vector(32 downto 0);
|
||||
signal writing_first_stripe : std_logic;
|
||||
|
||||
signal diag_peek_data_int : diag_array_t(0 to MAX_OP_WIDTH - 1)(PX_WIDTH - 1 downto 0);
|
||||
signal is_en_peek : std_logic;
|
||||
signal diag_peek_data_int : diag_array_t(0 to MAX_OP_WIDTH-1)(PX_WIDTH-1 downto 0);
|
||||
signal is_en_peek : std_logic;
|
||||
|
||||
signal rdreq_vec_int : std_logic_vector(MAX_OP_WIDTH-1 downto 0);
|
||||
|
||||
begin
|
||||
|
||||
-- pragma translate_off
|
||||
assert FULL_MARGIN < PX_DEPTH report "FULL_MARGIN must be < PX_DEPTH" severity failure;
|
||||
-- pragma translate_on
|
||||
|
||||
GEN_PIXEL_BUFFERS : for i in 0 to MAX_OP_WIDTH - 1 generate
|
||||
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;
|
||||
|
||||
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';
|
||||
|
||||
pixel_ram_inst : entity work.pixel_ram_0
|
||||
generic map(
|
||||
generic map (
|
||||
DEPTH => PX_DEPTH,
|
||||
WIDTH => PX_WIDTH
|
||||
)
|
||||
port map
|
||||
)
|
||||
port map
|
||||
(
|
||||
clock => clk,
|
||||
data => data_int,
|
||||
rdaddress => rd_ptr_int(PX_DEPTH_LOG2 - 1 downto 0),
|
||||
wraddress => wr_ptr(PX_DEPTH_LOG2 - 1 downto 0),
|
||||
rdaddress => rd_ptr_int(i)(PX_DEPTH_LOG2-1 downto 0),
|
||||
wraddress => wr_ptr(PX_DEPTH_LOG2-1 downto 0),
|
||||
wren => wren(i),
|
||||
q => q((i + 1) * PX_WIDTH - 1 downto i * PX_WIDTH)
|
||||
);
|
||||
q => q((i+1)*PX_WIDTH-1 downto i*PX_WIDTH)
|
||||
);
|
||||
end generate GEN_PIXEL_BUFFERS;
|
||||
|
||||
word_wrap_plus1 <= std_logic_vector(unsigned(word_wrap) + 1);
|
||||
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' 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';
|
||||
|
||||
error <= underrun or overrun or dbl_drop;
|
||||
error <= underrun or overrun or dbl_drop;
|
||||
|
||||
pixel_buf_rdy <= not full and not error;
|
||||
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);
|
||||
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));
|
||||
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_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';
|
||||
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);
|
||||
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);
|
||||
|
||||
-- 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';
|
||||
rd_ptr_int <= rd_ptr when diag_peek_sel = '0' else "0" & diag_peek_addr(PX_DEPTH_LOG2 - 1 downto 0);
|
||||
is_en_peek <= '1';
|
||||
GEN_RDPTR_INT : for i in 0 to MAX_OP_WIDTH-1 generate
|
||||
rd_ptr_int(i) <= rd_ptr(i) when diag_peek_sel = '0' else "0" & diag_peek_addr(PX_DEPTH_LOG2-1 downto 0);
|
||||
end generate;
|
||||
end generate;
|
||||
|
||||
|
||||
-- When no buffer peeking, use only the calculatrated read address
|
||||
GENNOPL : if not EN_PEEK generate
|
||||
is_en_peek <= '0';
|
||||
rd_ptr_int <= rd_ptr;
|
||||
is_en_peek <= '0';
|
||||
GEN_RDPTR_INT : for i in 0 to MAX_OP_WIDTH-1 generate
|
||||
rd_ptr_int(i) <= rd_ptr(i);
|
||||
end generate;
|
||||
end generate;
|
||||
|
||||
PX_BUF_CTRL : process(rst_n, clk) is
|
||||
variable op_width : OP_WIDTH_RANGE;
|
||||
begin
|
||||
if rst_n = '0' then
|
||||
rd_ptr <= (others => '0');
|
||||
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';
|
||||
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';
|
||||
|
||||
elsif clk'event and clk = '1' then
|
||||
|
||||
wr_req_int <= wrreq;
|
||||
data_int <= last_word & data;
|
||||
wr_req_int <= wrreq;
|
||||
data_int <= last_word & data;
|
||||
|
||||
if clear_buffer = '1' then
|
||||
rd_ptr <= (others => '0');
|
||||
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';
|
||||
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';
|
||||
end if;
|
||||
|
||||
if fp_holdoff_update = '1' then
|
||||
holdoff_count <= wave_seq_len;
|
||||
holdoff_count <= wave_seq_len;
|
||||
elsif unsigned(holdoff_count) /= 0 then
|
||||
holdoff_count <= std_logic_vector(unsigned(holdoff_count) - 1);
|
||||
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;
|
||||
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)
|
||||
|
|
@ -298,17 +319,19 @@ begin
|
|||
-- grey level mapping and waveform.
|
||||
if start_req = '1' and error = '0' then
|
||||
if start_req_first = '1' then
|
||||
rd_ptr_start <= rd_ptr;
|
||||
rd_ptr_start <= rd_ptr(0);
|
||||
else
|
||||
rd_ptr <= rd_ptr_start;
|
||||
for i in 0 TO MAX_OP_WIDTH-1 loop
|
||||
rd_ptr(i) <= rd_ptr_start;
|
||||
end loop;
|
||||
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';
|
||||
is_last_wave <= '1';
|
||||
else
|
||||
is_last_wave <= '0';
|
||||
is_last_wave <= '0';
|
||||
end if;
|
||||
end if;
|
||||
|
||||
|
|
@ -317,17 +340,19 @@ begin
|
|||
-- 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), diag_peek_rdptr'length));
|
||||
diag_peek_rdptr <= std_logic_vector(resize(unsigned(rd_ptr(0)), diag_peek_rdptr'length));
|
||||
end if;
|
||||
|
||||
-- Increment the read pointer for each read request
|
||||
if rdreq = '1' and error = '0' then
|
||||
rd_ptr <= std_logic_vector(unsigned(rd_ptr) + 1);
|
||||
end if;
|
||||
|
||||
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) - 1 + PX_DEPTH_LOG2 downto PX_DEPTH_LOG2)) then
|
||||
diag_peek_data <= q((i + 1) * PX_WIDTH - 2 downto i * PX_WIDTH);
|
||||
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;
|
||||
|
||||
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)-1+PX_DEPTH_LOG2 downto PX_DEPTH_LOG2)) then
|
||||
diag_peek_data <= q((i+1)*PX_WIDTH-2 downto i*PX_WIDTH);
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
|
|
@ -337,27 +362,27 @@ begin
|
|||
-- 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');
|
||||
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);
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
buf_word_count <= std_logic_vector(unsigned(buf_word_count) + 1);
|
||||
wr_ptr <= wr_ptr_plus1;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
|
|
@ -366,40 +391,42 @@ begin
|
|||
-- 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 = '0' or is_last_wave = '0') then
|
||||
word_count <= std_logic_vector(unsigned(word_count) + 1);
|
||||
elsif wren(0) = '0' and rdreq = '1' and is_last_wave = '1' then
|
||||
word_count <= std_logic_vector(unsigned(word_count) - 1);
|
||||
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';
|
||||
overrun <= '1';
|
||||
end if;
|
||||
|
||||
if writing_first_stripe = '1' and rdreq = '1' then
|
||||
underrun <= '1';
|
||||
if writing_first_stripe = '1' and rdreq_vec_int(0) = '1' then
|
||||
underrun <= '1';
|
||||
end if;
|
||||
|
||||
-- If a drop of a fire pulse is detected, remember that here
|
||||
if fire_drop_detect = '1' then
|
||||
fp_drop <= '1';
|
||||
fp_drop <= '1';
|
||||
if pend_drop_detect = '1' then
|
||||
dbl_drop <= '1';
|
||||
dbl_drop <= '1';
|
||||
end if;
|
||||
pend_drop_detect <= '1';
|
||||
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 then
|
||||
pend_drop_detect <= '0';
|
||||
rd_ptr <= std_logic_vector(unsigned(rd_ptr) + unsigned(drop_adjust));
|
||||
word_count <= std_logic_vector(unsigned(word_count) - unsigned(drop_adjust));
|
||||
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;
|
||||
end architecture;
|
||||
Loading…
Add table
Add a link
Reference in a new issue