A
Anand P Paralkar
Guest
Hi,
I have written a model to calculate the parity of a 'n' bit vector (n is
even). The idea is to recursively generate the tree until the span of the
tree covers the entire length of 'n'. A tree that covers a vector of
length n requires a log2 levels/height. Vice-versa, a tree with level
'l' can calculate the parity of a (2 ** l) bit vector.
So much for the theory. Here is the code:
-------------------------------------------------------------------------
entity pargen is
generic (level : positive := 5);
port (z : out bit;
d : in bit_vector (0 to ((2**level) - 1)));
end entity pargen;
architecture recur of pargen is
begin
degenerate_tree : if (level = 0) generate
z <= d(0);
end generate degenerate_tree;
compound_tree : if (level > 0) generate
signal lin, rin : bit;
begin
par_gate : entity work.xorg(gatel)
port map (lin, rin, z);
sub_tree_l : entity work.pargen(recur)
generic map (level - 1)
port map (z => lin, d => d(0 to ((2**(level - 1)) - 1)));
sub_tree_r : entity work.pargen(recur)
generic map (level - 1)
port map (z => rin, d => d((2**(level - 1)) to ((2**level) - 1)));
end generate compound_tree;
end architecture recur;
--------------------------------------------------------------------------
The entity xorg is a model for an xor gate. It is compiled and present
in the work library.
The pargen model is instantiated in a test bench as follows:
--------------------------------------------------------------------------
entity tb_pargen is
end entity tb_pargen;
architecture test of tb_pargen is
signal parout : bit;
signal d : bit_vector (0 to 15);
begin
DUT : entity work.pargen(recur)
generic map (4)
port map (parout, d);
end architecture test;
---------------------------------------------------------------------------
Problem: The test bench compiles correctly but elaboration (ncelab) gives
the following error:
ncelab -v93 -messages WORK.TB_PARGEN:TEST
ncelab: v03.30.(s012): (c) Copyright 1995 - 2002 Cadence Design Systems,
Inc.
Elaborating the design hierarchy:
Simulation execution error detected: range constraint violation
source file: ex14_14.vhd, line = 2, position = 15
Unknown stream type (in design unit WORK.PARGEN:RECUR)
Direct instantiation elaboration for instance:
:tb_pargen(test)UT@pargen(recur):compound_tree:sub_tree_l
ncelab: *E,CUELEE: execution error prevents further elaboration.
Could somebody please explain what the problem could be. (Note: This
circuit synthesizes correctly (using Synplify Pro).)
Thanks,
Anand
I have written a model to calculate the parity of a 'n' bit vector (n is
even). The idea is to recursively generate the tree until the span of the
tree covers the entire length of 'n'. A tree that covers a vector of
length n requires a log2 levels/height. Vice-versa, a tree with level
'l' can calculate the parity of a (2 ** l) bit vector.
So much for the theory. Here is the code:
-------------------------------------------------------------------------
entity pargen is
generic (level : positive := 5);
port (z : out bit;
d : in bit_vector (0 to ((2**level) - 1)));
end entity pargen;
architecture recur of pargen is
begin
degenerate_tree : if (level = 0) generate
z <= d(0);
end generate degenerate_tree;
compound_tree : if (level > 0) generate
signal lin, rin : bit;
begin
par_gate : entity work.xorg(gatel)
port map (lin, rin, z);
sub_tree_l : entity work.pargen(recur)
generic map (level - 1)
port map (z => lin, d => d(0 to ((2**(level - 1)) - 1)));
sub_tree_r : entity work.pargen(recur)
generic map (level - 1)
port map (z => rin, d => d((2**(level - 1)) to ((2**level) - 1)));
end generate compound_tree;
end architecture recur;
--------------------------------------------------------------------------
The entity xorg is a model for an xor gate. It is compiled and present
in the work library.
The pargen model is instantiated in a test bench as follows:
--------------------------------------------------------------------------
entity tb_pargen is
end entity tb_pargen;
architecture test of tb_pargen is
signal parout : bit;
signal d : bit_vector (0 to 15);
begin
DUT : entity work.pargen(recur)
generic map (4)
port map (parout, d);
end architecture test;
---------------------------------------------------------------------------
Problem: The test bench compiles correctly but elaboration (ncelab) gives
the following error:
ncelab -v93 -messages WORK.TB_PARGEN:TEST
ncelab: v03.30.(s012): (c) Copyright 1995 - 2002 Cadence Design Systems,
Inc.
Elaborating the design hierarchy:
Simulation execution error detected: range constraint violation
source file: ex14_14.vhd, line = 2, position = 15
Unknown stream type (in design unit WORK.PARGEN:RECUR)
Direct instantiation elaboration for instance:
:tb_pargen(test)UT@pargen(recur):compound_tree:sub_tree_l
ncelab: *E,CUELEE: execution error prevents further elaboration.
Could somebody please explain what the problem could be. (Note: This
circuit synthesizes correctly (using Synplify Pro).)
Thanks,
Anand