What is value of Var1 after the following assignment? (Verilog)

Status
Not open for further replies.

abhineet22

Advanced Member level 4
Joined
Jan 25, 2005
Messages
105
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Location
bangalore
Activity points
1,017
What is value of Var1 after the following assignment ?


reg Var1;

initial begin

Var1<= "-"

end
 

Re: program of verilog?

Interview question I guess .........
It is rather simple here the '-' sign does not denote any value .Remember that in verilog the valid values are only 1,0,X,Z . So when you assign "-" . this is treated as a string and then the ascii value of this "-" is taken which is 2D is hex. The '0' bit value of "-" is ascii is then assigned to the variable . I hope I have answered your question .
 

Re: program of verilog?

Var1 will be "-"'s ASCII character value

best regards



abhineet22 said:
What is value of Var1 after the following assignment ?


reg Var1;

initial begin

Var1<= "-"

end
 

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