mirror of
https://github.com/steveicarus/iverilog.git
synced 2026-09-03 03:23:31 +02:00
By adding ivtest to the iverilog source tree, it is easier to keep the regression test synchronized with the source that is being tested. This should be especially helpful for PRs that add a new feature, and have a matching ivtest PR with the regression test for that feature.
46 lines
1.2 KiB
Verilog
46 lines
1.2 KiB
Verilog
module main;
|
|
reg signed [7:0] a;
|
|
reg [7:0] b;
|
|
initial begin
|
|
// Make sure the arithmetic right shift sign extends
|
|
$display("simple arithmetic right shift");
|
|
a = 8'b11001001;
|
|
$display("before: a = %b", a);
|
|
a = a>>>1;
|
|
$display("after: a = %b", a);
|
|
if (a !== 8'b11100100) begin
|
|
$display("FAILED");
|
|
$finish;
|
|
end
|
|
|
|
// The concatenation operator is always unsigned, so
|
|
// it must turn off sign extension.
|
|
$display("concatenated arithmetic right shift");
|
|
a = 8'b11001001;
|
|
b = 0;
|
|
$display("before: a = %b", a);
|
|
{a,b} = {a,b}>>>1;
|
|
$display("after: a = %b", a);
|
|
if (a !== 8'b01100100) begin
|
|
$display("FAILED");
|
|
$finish;
|
|
end
|
|
|
|
|
|
// The concatenation operator is always unsigned, but
|
|
// we can turn on signed behavior with $signed.
|
|
$display("concatenated arithmetic right shift with $signed");
|
|
a = 8'b11001001;
|
|
b = 0;
|
|
$display("before: a = %b", a);
|
|
{a,b} = $signed({a,b})>>>1;
|
|
$display("after: a = %b", a);
|
|
if (a !== 8'b11100100) begin
|
|
$display("FAILED");
|
|
$finish;
|
|
end
|
|
|
|
$display("PASSED");
|
|
end
|
|
endmodule
|