problem with data flow modelling

C

crackle24

here is the code i wrote to model a decade counter using data flow
modelling.



Entity decade_jk is
Port ( clk: in std_logic;
A: inout std_logic_vector(3 downto 0):="0000");
End decade_jk;

Architecture df_x_decade of decade_jk is

Signal Count : std_logic_vector(3 downto 0):="0000";
Begin
Count <=count + "0001" when clk='1' and clk'event and
count<"1010" else
"0000" when clk='1' and clk'event and count="1001" else
unaffected;
A<=count;

End df_x_decade;

it gives me an error telling me the assignment statement to count is
not right.although the code shows no error when i remove the clk'event
condition but then what happens is that as long as clk is 1 count keeps
incrementing and count increments by 1 even when clk is zero.and the
xilinx version i use does not accept unaffected although it recognises
it as a keyword.
 
M

Mike Treseler

crackle24 said:
what happens is that as long as clk is 1 count keeps
incrementing and count increments by 1 even when clk is zero.

That is what I would expect, since a concurrent
statement is a process with no wait.

-- Mike Treseler
 
C

crackle24

is dere any way 2 solve de problem?
the behavioral model is not a problem.i need 2 write de code using data
flow only.can u please help?
 
A

Andy

Not exactly, since a concurrent assignment statement is an implied
process with an implied sensitivity list made up of all signals on the
left hand side. Therefore there is an implied wait statement on all of
those signals too.

What is happening is that the implied process is sensitive to count
also, so when it increments, it re-triggers the process, incrementing
it again. With the 'event part added, it cannot update the counter
except once per clock.

Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top