0
在if(lr == 0)的行上,我收到以下錯誤」預計'endmodule',找到'if'。 Verilog代碼是一個8位移位寄存器,用作左右移位器,可以在算術和邏輯移位之間進行選擇。我看不出爲什麼我收到錯誤。這可能是一種類型的語法錯誤,因爲我是Verilog的新手。感謝您提前提供任何幫助。收到以下錯誤:「行36期待'endmodule',找到'if'
module shifter(
input [7:0] shift_in,
input [2:0] shift_by,
// 0 for left, 1 for right
input lr,
//0 for logical, 1 for arithmetic
input arith,
output reg signed [7:0] shift_out
);
//left shift
if(lr == 0)
begin
assign shift_out = shift_in << shift_by;
assign shift_out[0] = 1'b0;
end
//right shift
else begin
//logical shift
if (arith == 0) begin
assign shift_out = shift_in << shift_by;
assign shift_out[7] = 1'b0;
//arithmetic shift
end else begin
assign shift_out[7] = shift_in[7];
assign shift_out = shift_in << shift_by;
end
end
endmodule
謝謝配合它的工作的變化。 – Sammyr93 2015-02-12 16:03:35