You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, the outputs before and after synthesis are inconsistent when performing bitwise operations on signed numbers in Verilog using Yosys. However, it seems that Yosys provided the correct output.
Given my original design, when the input wire1 is 6'b110011, the for loop should execute, and the if condition should be true, resulting in the output y being 01. However, simulation results show that the original design outputs 00, while the synthesized design outputs 01.
module top (y, clk, wire1);
output wire [1:0] y;
input wire clk;
input wire signed [5:0] wire1;
reg signed [1:0] forvar7 = 2'b00;
reg signed [6:0] forvar5 = 7'b0000000;
assign y = {forvar7};
always
@(posedge clk)
begin
for (forvar5 = (7'b0000000); (forvar5 < (7'b0000001)); forvar5 = (forvar5 + (7'b0000001)))
begin
if ( (^(forvar5 + wire1) ? forvar5 : wire1) )
begin
forvar7 = (2'b01);
end
end
end
endmodule
The testbench is as follows:
`include "rtl.v"
module testbench;
reg clk;
reg signed [5:0] wire1;
wire [1:0] y;
top uut (
.y(y),
.clk(clk),
.wire1(wire1)
);
initial begin
clk = 0;
forever #5 clk = ~clk;
end
initial begin
wire1 = 6'b110011;
#10;
$display("At time %t, y = %b", $time, y);
#20;
$finish;
end
endmodule
This discussion was converted from issue #4398 on May 16, 2024 03:38.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Version
Yosys 0.39+165
On which OS did this happen?
Linux
Reproduction Steps
Hello, the outputs before and after synthesis are inconsistent when performing bitwise operations on signed numbers in Verilog using Yosys. However, it seems that Yosys provided the correct output.
Given my original design, when the input
wire1
is6'b110011
, thefor
loop should execute, and theif
condition should be true, resulting in the outputy
being01
. However, simulation results show that the original design outputs00
, while the synthesized design outputs01
.The testbench is as follows:
yosys_5_15.zip
Expected Behavior
I think the yosys tool is correct, but why does it output inconsistent
Actual Behavior
Inconsistent output before and after synthesis
Beta Was this translation helpful? Give feedback.
All reactions