mirror of
https://github.com/antonblanchard/microwatt.git
synced 2026-01-11 23:43:15 +00:00
countbits: Move more popcount calculation before the clock edge
Popcount takes two cycles to execute. The computation of the final popcount value in the second cycle has showed up as a critical path on the Artix-7, so move one stage of the summation back into the first cycle. Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
This commit is contained in:
parent
b14dd43ce6
commit
51dd7f578f
@ -42,6 +42,10 @@ architecture behaviour of bit_counter is
|
|||||||
type fourbit8 is array(0 to 7) of fourbit;
|
type fourbit8 is array(0 to 7) of fourbit;
|
||||||
signal pc8 : fourbit8;
|
signal pc8 : fourbit8;
|
||||||
signal pc8_r : fourbit8;
|
signal pc8_r : fourbit8;
|
||||||
|
subtype fivebit is unsigned(4 downto 0);
|
||||||
|
type fivebit4 is array(0 to 3) of fivebit;
|
||||||
|
signal pc16 : fivebit4;
|
||||||
|
signal pc16_r : fivebit4;
|
||||||
subtype sixbit is unsigned(5 downto 0);
|
subtype sixbit is unsigned(5 downto 0);
|
||||||
type sixbit2 is array(0 to 1) of sixbit;
|
type sixbit2 is array(0 to 1) of sixbit;
|
||||||
signal pc32 : sixbit2;
|
signal pc32 : sixbit2;
|
||||||
@ -96,6 +100,9 @@ begin
|
|||||||
for i in 0 to 7 loop
|
for i in 0 to 7 loop
|
||||||
pc8_r(i) <= pc8(i);
|
pc8_r(i) <= pc8(i);
|
||||||
end loop;
|
end loop;
|
||||||
|
for i in 0 to 3 loop
|
||||||
|
pc16_r(i) <= pc16(i);
|
||||||
|
end loop;
|
||||||
dlen_r <= datalen;
|
dlen_r <= datalen;
|
||||||
pcnt_r <= do_popcnt;
|
pcnt_r <= do_popcnt;
|
||||||
end if;
|
end if;
|
||||||
@ -113,11 +120,13 @@ begin
|
|||||||
for i in 0 to 7 loop
|
for i in 0 to 7 loop
|
||||||
pc8(i) <= ('0' & pc4(i * 2)) + ('0' & pc4(i * 2 + 1));
|
pc8(i) <= ('0' & pc4(i * 2)) + ('0' & pc4(i * 2 + 1));
|
||||||
end loop;
|
end loop;
|
||||||
|
for i in 0 to 3 loop
|
||||||
|
pc16(i) <= ('0' & pc8(i * 2)) + ('0' & pc8(i * 2 + 1));
|
||||||
|
end loop;
|
||||||
|
|
||||||
-- after a clock edge
|
-- after a clock edge
|
||||||
for i in 0 to 1 loop
|
for i in 0 to 1 loop
|
||||||
pc32(i) <= ("00" & pc8_r(i * 4)) + ("00" & pc8_r(i * 4 + 1)) +
|
pc32(i) <= ('0' & pc16_r(i * 2)) + ('0' & pc16_r(i * 2 + 1));
|
||||||
("00" & pc8_r(i * 4 + 2)) + ("00" & pc8_r(i * 4 + 3));
|
|
||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
popcnt <= (others => '0');
|
popcnt <= (others => '0');
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user