What kind of logic after synthesis of this rtl

Status
Not open for further replies.

sun_ray

Advanced Member level 3
Joined
Oct 3, 2011
Messages
772
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,298
Activity points
6,828
What logic will following synthesize to? Please draw the schematic

Code:
always @ (*)
begin
if (s)
y= a;
if (r)
y=b;
end
 

Suppose, something like that...It will follow to asynchronous sequential logic.
 
Reactions: FvM

    FvM

    Points: 2
    Helpful Answer Positive Rating
Seems like having unknown states, so that variants of that circuit could satisfy the code above.
 

The circuit implements a combinational latch by specification, including an unknown initial state. It's exactly corresponding to the Verilog description.
 

Because the code below is a really poor description of a circuit
Code:
always @ (*)
begin
if (s)
y= a;
if (r)
y=b;
end
And based on the the above description, miskod gave a reasonable result of what a synthesis tool will likely implement.

This is why I really dislike people who insist on writing code where multiple lines are assigning the same signal that are not structurally within the same control statement.

How will output y gets values of input a when s=1 but r='x' or r='z' in the above schematic?
It won't get the value of a because the ridiculous coding style of following one if statement with another if statement that assigns the same variable ends up sequentially changing the value of y to x due to the x/z on r.

You need to read the LRM or a good book on the execution flow of Verilg.
 

How will output y gets values of input a when s=1 but r='x' or r='z' in the above schematic?
Irrelevant I think, 'x' or 'z' input don't exist in synthesized hardware.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…