Will this generate different HW?

V

Valentin Tihomirov

The question may a bit silly one but anyway... Assuming the process is
synchronous.

(a)

Ack <= Loading;

(b)

if Loading = '1' then
Ack <= '1';
else
Ack <= '0';
end if;

or the same

Ack <= '0';
if Loading = '1' then
Ack <= '1';
end if;


The first should assign a signal directly while second assigns an output of
a mux.
 
M

Mike Treseler

Valentin said:
The question may a bit silly one but anyway... Assuming the process is
synchronous.

(a)

Ack <= Loading;

(b)

if Loading = '1' then
Ack <= '1';
else
Ack <= '0';
end if;

or the same

Ack <= '0';
if Loading = '1' then
Ack <= '1';
end if;


The first should assign a signal directly while second assigns an output of
a mux.

All three examples assign Ack with the value of
Loading from the previous clock edge.

I would expect synthesis to be the same in
all three cases. Try it and see.

For simulation,(b) zero's out H L and Z
while (a) does not.

-- Mike Treseler
 
M

Mike

I would expect the last two statements to be minimized to the equivalent of
the first one.
 
L

Lars Wehmeyer

Mike said:
All three examples assign Ack with the value of
Loading from the previous clock edge.

I would expect synthesis to be the same in
all three cases. Try it and see.

For simulation,(b) zero's out H L and Z
while (a) does not.

I guess this is the point: what are the data types of your
signals? If it's BIT, then they might be the same.
If they're STD_LOGIC, they behave differently and should
thus generate different hardware.

Lars
 
M

Mike Treseler

Valentin said:
What are the considerations to choose between the styles?

1. Easy to read and understand.
2. Compatible with your tools.

-- Mike Treseler
 
T

Thomas Stanka

Lars Wehmeyer said:
Mike said:
All three examples assign Ack with the value of
Loading from the previous clock edge. [..]
For simulation,(b) zero's out H L and Z
while (a) does not.

I guess this is the point: what are the data types of your
signals? If it's BIT, then they might be the same.
If they're STD_LOGIC, they behave differently and should
thus generate different hardware.

No. The simulations may differ, but I expect no synthesis tool to
produce different HW. Std_Logic differs from Bit only during
simulations.

bye Thomas
 

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

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top