FF array, is it a valid way to write it?

M

MM

Guest
Hi all,

Is the code below valid (including for synthesis)?


signal clk : std_logic_vector(0 to 3);

PROC:
process (clk)
begin
LP1:
for i in 0 to NUM loop
if clk(i)'event and clk(i)='0' then
queue(i) <= ldata(i);
end if;
end loop;
end process;

Thanks,
/Mikhail
 
No.

You need to create a component model for the ff and then use a for-generate
statement loop that instantiates and connects them together.



"MM" <mbmsv@yahoo.com> wrote in message
news:2jgpihF11ck8aU1@uni-berlin.de...
Hi all,

Is the code below valid (including for synthesis)?


signal clk : std_logic_vector(0 to 3);

PROC:
process (clk)
begin
LP1:
for i in 0 to NUM loop
if clk(i)'event and clk(i)='0' then
queue(i) <= ldata(i);
end if;
end loop;
end process;

Thanks,
/Mikhail
 
JJ wrote:

You need to create a component model for the ff and then use a for-generate
statement loop that instantiates and connects them together.
Could anybody tell me, why:


signal clk : std_logic_vector(0 to 3);

gen_gueues : for i in 0 to NUM generate
process (clk)
begin
if clk(i)'event and clk(i)='0' then
queue(i) <= ldata(i);
end if;
end process;
end generate;


is not allowed? This works in Cadence Leapfrog for simulation, but
Synopys Design Analyzer gives an error during synthesis.


Ralf
 
Hi Ralf,

Have you see that you demand to connect a bus (clk), and use only 1 bit
(depending of i).

What is the value of NUM ? greater than 3 ?

And finally, what is the error message ?

JaI

Ralf Hildebrandt wrote:

JJ wrote:

You need to create a component model for the ff and then use a
for-generate
statement loop that instantiates and connects them together.


Could anybody tell me, why:


signal clk : std_logic_vector(0 to 3);

gen_gueues : for i in 0 to NUM generate
process (clk)
begin
if clk(i)'event and clk(i)='0' then
queue(i) <= ldata(i);
end if;
end process;
end generate;


is not allowed? This works in Cadence Leapfrog for simulation, but
Synopys Design Analyzer gives an error during synthesis.


Ralf
 
Hi MM,

See lrm, section 9.3 Generate Statement.

for..generate is a generate statement, and generate statements are
concurential statement.

process is a sequential statement, and sequential statement doesn't
embedded concurential statement.

JaI

MM wrote:

Hi all,

Is the code below valid (including for synthesis)?


signal clk : std_logic_vector(0 to 3);

PROC:
process (clk)
begin
LP1:
for i in 0 to NUM loop
if clk(i)'event and clk(i)='0' then
queue(i) <= ldata(i);
end if;
end loop;
end process;

Thanks,
/Mikhail
 
Hi Steve,

You are rigth, I a met a short cut in my explanation.

Thx,
JaI

steven wrote:

Just an Illusion <illusion_to_net@yahoo.fr> wrote in message news:<40D6DF2D.1020100@yahoo.fr>...


Hi MM,

See lrm, section 9.3 Generate Statement.

for..generate is a generate statement, and generate statements are
concurential statement.

process is a sequential statement, and sequential statement doesn't
embedded concurential statement.

JaI




Hi,

A process is a concurrent statement, the statements within a process are sequential.

Steven
 
Just an Illusion wrote:


Have you see that you demand to connect a bus (clk), and use only 1 bit
(depending of i).

What is the value of NUM ? greater than 3 ?

And finally, what is the error message ?
O.k. - here is an example - a asyncronous counter, that I have used in
one of my designs:

For my architecture the following generic parameter is given in the entity:

generic(
timerwidth : integer:=5 );


A vector is defined with:
signal cnt_async : std_ulogic_vector(timerwidth-2 downto 0);


Now I wanted to model an asynchronous counter:

gen_cnt_async : for N in 1 to timerwidth-2 generate
process(por_n,clk_rc_len,reset_cnt_async,cnt_async)
begin
if (por_n='0' OR clk_rc_len='0' OR reset_cnt_async='1') then
cnt_async(N)<='0';
elsif falling_edge(cnt_async(N-1)) then
cnt_async(N)<=NOT(cnt_async(N));
end if;
end process;
end generate;


I used Synopsys DesignAnalyzer 2003.06. During

analyze -format vhdl {"<my_behavior.vhd>"}

I got this error message

Error: Arbitraty expression for bussed clock index is not supported.
(VHDL-284)


Behavioral simulation in Cadence Leapfrog was running fine without error.
If I unroll the generic expression, everything is fine even in Synopsys
Design Analyzer. The following synthesizes and simulates (with SDF
backannotation) well:

process(por_n,clk_rc_len,reset_cnt_async,cnt_async)
begin
if (por_n='0' OR clk_rc_len='0' OR reset_cnt_async='1') then
cnt_async(1)<='0';
elsif falling_edge(cnt_async(0)) then
cnt_async(1)<=NOT(cnt_async(1));
end if;
end process;

process(por_n,clk_rc_len,reset_cnt_async,cnt_async)
begin
if (por_n='0' OR clk_rc_len='0' OR reset_cnt_async='1') then
cnt_async(2)<='0';
elsif falling_edge(cnt_async(1)) then
cnt_async(2)<=NOT(cnt_async(2));
end if;
end process;

process(por_n,clk_rc_len,reset_cnt_async,cnt_async)
begin
if (por_n='0' OR clk_rc_len='0' OR reset_cnt_async='1') then
cnt_async(3)<='0';
elsif falling_edge(cnt_async(2)) then
cnt_async(3)<=NOT(cnt_async(3));
end if;
end process;


Maybe it is only a problem of my synthesis tool, that simply is "too
stupid" for it. ;-)

Ralf
 
On Tue, 22 Jun 2004 16:23:16 +0200, Ralf Hildebrandt <Ralf-Hildebrandt@gmx.de>
wrote:

gen_cnt_async : for N in 1 to timerwidth-2 generate
process(por_n,clk_rc_len,reset_cnt_async,cnt_async)
begin
if (por_n='0' OR clk_rc_len='0' OR reset_cnt_async='1') then
cnt_async(N)<='0';
elsif falling_edge(cnt_async(N-1)) then
cnt_async(N)<=NOT(cnt_async(N));
end if;
end process;
end generate;

I used Synopsys DesignAnalyzer 2003.06. During

analyze -format vhdl {"<my_behavior.vhd>"}

I got this error message

Error: Arbitraty expression for bussed clock index is not supported.
(VHDL-284)
Would it be acceptable to create a 1-bit counter as a component, and generate N
instances of that component, using the generate loop to extract a single clock
signal from the vector? I hope THAT would get through the synthesis tool...

- Brian
 

Welcome to EDABoard.com

Sponsor

Back
Top