Skip to content

Commit 96ef8dc

Browse files
committed
fix(mfb_tools): fix support narrower word widths in MFB Generator
1 parent 8bb4388 commit 96ef8dc

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

comp/mfb_tools/debug/generator/mfb_generator.vhd

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ architecture BEHAV of MFB_GENERATOR is
137137

138138
signal sof_pos_arr : slv_array_t(REGIONS-1 downto 0)(max(1, log2(REGION_SIZE))-1 downto 0);
139139
signal sof_index : u_array_t(REGIONS-1 downto 0)(max(1, log2(REGIONS*REGION_SIZE))-1 downto 0);
140-
signal data_word_plus : slv_array_t(2*REGIONS*REGION_SIZE-1 downto 0)(BLOCK_SIZE*ITEM_WIDTH-1 downto 0);
141-
signal data_word_plus_reg : slv_array_t(REGIONS*REGION_SIZE-1 downto 0)(BLOCK_SIZE*ITEM_WIDTH-1 downto 0);
140+
signal data_word_plus : slv_array_t(REGIONS*REGION_SIZE+6-1 downto 0)(BLOCK_SIZE*ITEM_WIDTH-1 downto 0);
141+
signal data_word_plus_reg : slv_array_t(6-1 downto 0)(BLOCK_SIZE*ITEM_WIDTH-1 downto 0);
142142
signal data_word : slv_array_t(REGIONS*REGION_SIZE-1 downto 0)(BLOCK_SIZE*ITEM_WIDTH-1 downto 0);
143143
signal data_word_ser : std_logic_vector(REGIONS*REGION_SIZE*BLOCK_SIZE*ITEM_WIDTH-1 downto 0);
144144

@@ -482,21 +482,14 @@ begin
482482

483483
process (all)
484484
begin
485-
for b in 0 to REGIONS*REGION_SIZE-1 loop
486-
data_word_plus(b) <= data_word_plus_reg(b);
487-
end loop;
488-
for c in REGIONS*REGION_SIZE to 2*REGIONS*REGION_SIZE-1 loop
489-
data_word_plus(c) <= (others => '0');
490-
end loop;
491-
for i in 0 to REGIONS-1 loop
492-
sof_index(i) <= resize(unsigned(sof_pos_arr(i)),log2(REGIONS*REGION_SIZE)) + i*REGION_SIZE;
493-
if (sof(i) = '1') then
494-
data_word_plus(to_integer(sof_index(i))) <= eth_hdr_384b(i)(64-1 downto 0);
495-
data_word_plus(to_integer(sof_index(i))+1) <= eth_hdr_384b(i)(128-1 downto 64);
496-
data_word_plus(to_integer(sof_index(i))+2) <= eth_hdr_384b(i)(192-1 downto 128);
497-
data_word_plus(to_integer(sof_index(i))+3) <= eth_hdr_384b(i)(256-1 downto 192);
498-
data_word_plus(to_integer(sof_index(i))+4) <= eth_hdr_384b(i)(320-1 downto 256);
499-
data_word_plus(to_integer(sof_index(i))+5) <= eth_hdr_384b(i)(384-1 downto 320);
485+
data_word_plus <= (others => (others => '0'));
486+
data_word_plus(6-1 downto 0) <= data_word_plus_reg;
487+
for ii in 0 to REGIONS-1 loop
488+
sof_index(ii) <= resize(unsigned(sof_pos_arr(ii)), log2(REGIONS*REGION_SIZE)) + ii*REGION_SIZE;
489+
if (sof(ii) = '1') then
490+
for jj in 0 to 5 loop
491+
data_word_plus(to_integer(sof_index(ii))+jj) <= eth_hdr_384b(ii)((jj+1)*64-1 downto jj*64);
492+
end loop;
500493
end if;
501494
end loop;
502495
end process;
@@ -505,7 +498,7 @@ begin
505498
begin
506499
if (rising_edge(CLK)) then
507500
if (dst_rdy = '1') then
508-
data_word_plus_reg <= data_word_plus(2*REGIONS*REGION_SIZE-1 downto REGIONS*REGION_SIZE);
501+
data_word_plus_reg <= data_word_plus(REGIONS*REGION_SIZE+6-1 downto REGIONS*REGION_SIZE);
509502
end if;
510503
end if;
511504
end process;

0 commit comments

Comments
 (0)