Mike Treseler <
[email protected]> writes:
> I must admit that I didn't understand what the function was
> until I saw your description. Well done!
Thanks, but what I wrote is in fact a rather verbose implementation of
an or-reduce function[1], and thus at best a partial solution to the
OP's task (see the simple or-reduce used in the original code). I am
afraid *I* just understood what that Willem's code was supposed to
do. Well, it was a long night.
While I'd prefer the following description[2], I couldn't find any
problems with the original code using ModelSim.
process(aclr_l,clk)
begin
if aclr_l = '0' then
Tx_Clk_Cnt <= (others => '0');
elsif clk'event and clk = '1' then
Tx_Clk_Cnt <= Tx_Clk_Cnt + 1;
Tx_Clk_En <= (others => '0');
for n in 0 to Tx_Clk_En'high loop
exit when Tx_Clk_Cnt(n) = '0';
Tx_Clk_En(n) <= '1';
end loop;
end if;
end process;
Best regards,
Marcus
Footnotes:
[1] What's worse is the fact that it is verbose *and* inefficient. A
better implementation of an or-reduce would use a more balanced tree.
[2] I did't add a reset for Tx_Clk_En to keep the two versions as
close as possible.