On Thu, 3 Jul 2008 01:56:44 -0700 (PDT), Pasacco wrote:
>Dear
>
>I am having problem to implement "circular round-robin" priority
>encoder.
>
>My goal is to implement using "generic" number of ****ts.
>I tried to use two "for" loops.
>Problem was that the index is not always increasing.
It's probably best to normalise the index range internally
to your design. This really stupid little example should
show what I mean:
entity multi_bit_inverter is
****t (A: in std_logic_vector;
Y: out std_logic_vector);
end;
architecture RTL of multi_bit_inverter is
begin
-- Ex****t the blame if someone connected
-- inappropriate signals to this entity
assert A'length = Y'length
re****t "Instantiated ****t widths do not match"
severity FAILURE;
process (A)
variable normalised_A: std_logic_vector(A'length-1 downto 0);
variable normalised_Y: std_logic_vector(A'length-1 downto 0);
begin
normalised_A := A; -- this fixes any index direction problems.
-- Do the real work on your normalised versions:
for i in normalised_A'range loop
-- No problem with subscript directions now.
normalised_Y(i) := not normalised_A(i);
end loop;
-- Patch-up the array direction again to match the o/p ****t:
Y <= normalised_Y; -- again, fix-up index direction trouble.
end process;
end;
hth
--
Jonathan Bromley, Consultant
DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services
Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@[EMAIL PROTECTED]
contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.


|