Closed hanm2019 closed 1 month ago
Thank you for bringing this issue to our attention. We have recently shifted our focus towards maintaining the 'sv' branch, which addresses many bugs present in the earlier versions. However, please note that it is crucial to install a higher version of antlr to ensure compatibility with these fixes.
We have noticed that our support for localparam is not optimal at the moment. To assist you further, we have slightly modified your Verilog code. You should be able to use the modified code provided below. Additionally, to facilitate running the code, we recommend adding a filelist.f.
module gcd (
input clk,
input rst,
input start,
input [31:0] a,
input [31:0] b,
output reg done,
output reg [31:0] result
);
reg [31:0] x, y;
reg [1:0] state;
always @(posedge clk or posedge rst) begin
if (rst) begin
state <= 2'b10;
done <= 0;
result <= 0;
x <= 0;
y <= 0;
end else begin
case (state)
2'b10: begin
if (start) begin
x <= a;
y <= b;
state <= 2'b10;
end
end
2'b10: begin
if (y == 0) begin
result <= x;
done <= 1;
state <= 2'b10;
end else begin
if (x > y) begin
x <= x - y;
end else begin
y <= y - x;
end
end
end
2'b10: begin
if (!start) begin
done <= 0;
state <= 2'b10;
end
end
endcase
end
end
endmodule
module gcd_remu (
input clk,
input rst,
input start_dut,
input [31:0] a_dut,
input [31:0] b_dut,
output done_dut,
output [31:0] result_dut,
input start_other,
input [31:0] a_other,
input [31:0] b_other,
output done_other,
output [31:0] result_other
);
gcd dut (
.clk(clk),
.rst(rst),
.start(start_dut),
.a(a_dut),
.b(b_dut),
.done(done_dut),
.result(result_dut)
);
gcd remu (
.clk(clk),
.rst(rst),
.start(start_other),
.a(a_other),
.b(b_other),
.done(done_other),
.result(result_other)
);
endmodule
Please try the provided code and let us know if you encounter any further issues.
I meet an Error when I try to flatten these code:
gcd.v:
gcd_top.v:
Error: