@@ -24,6 +24,12 @@ module converter(input signed [7:0] si, input unsigned [7:0] ui);
24
24
wire unsigned [7 : 0 ] ub1 = ui; // unsigned 8 to unsigned 8
25
25
wire unsigned [7 : 0 ] ub2 = si; // signed 8 to unsigned 8
26
26
27
+ // just one bit
28
+ wire signed sbit1 = ui; // unsigned 8 to signed 1
29
+ wire signed sbit2 = si; // signed 8 to signed 1
30
+ wire unsigned ubit1 = ui; // unsigned 8 to unsigned 1
31
+ wire unsigned ubit2 = si; // signed 8 to unsigned 1
32
+
27
33
endmodule
28
34
29
35
module main ;
@@ -42,6 +48,10 @@ module main;
42
48
assert final (c.sb2 == - 120 );
43
49
assert final (c.ub1 == 136 );
44
50
assert final (c.ub2 == 136 );
51
+ assert final (c.sbit1 == 0 );
52
+ assert final (c.sbit2 == 0 );
53
+ assert final (c.ubit1 == 0 );
54
+ assert final (c.ubit2 == 0 );
45
55
46
56
initial begin
47
57
$display (" c.sw1 == " , c.sw1);
@@ -58,6 +68,11 @@ module main;
58
68
$display (" c.sb2 == " , c.sb2);
59
69
$display (" c.ub1 == " , c.ub1);
60
70
$display (" c.ub2 == " , c.ub2);
71
+
72
+ $display (" c.sbit1 == " , c.sbit1);
73
+ $display (" c.sbit2 == " , c.sbit2);
74
+ $display (" c.ubit1 == " , c.ubit1);
75
+ $display (" c.ubit2 == " , c.ubit2);
61
76
end
62
77
63
78
endmodule
0 commit comments