Verilog simple but bit confusing

Status
Not open for further replies.

balan

Member level 2
Joined
Feb 18, 2007
Messages
44
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,518
Let me know the output of this program

module tb;
reg [15:0] a;
initial begin
a=28'hff00;
$display("a = %h",a);
$display("a = %0h",a);
$display("a = %7h",a);

end
endmodule
 

whether the result which i get is expected.

1st display
ff00
2nd display
ff00
3rd display
ff00

Is that correct
 

The reg a is 16 bit, but the assignment is a = 28'h ff00 (assigned as 28 bit).

In the display we have given as $display("%7h",a)

I expect the value to be
000ff00.

Please let me know does %7h has any effect.
 

There must be something wrong with your answer.
you can simular with modelsim and you can see de result are:

1st display
ff00
2nd display
ff
3rd display
___ff00 (_means Space bar)
 

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