今ALUの内部に新しい命令を追加して、その命令の内部の処理は機能ライブラリを使用して別のファイルで行いたいと思います。入力されたkey,plaintextをそれぞれ足してその結果をoutに返したいです。ops, opcodes.vhは動作確認済みです。Compile Errorをしたら以下のように出ます。
Error (10170): Verilog HDL syntax error at cal.v(19) near text: "+"; expecting ";".
cal.v
1`default_nettype none 2module cal( 3wire [31 : 0] key_32, 4wire [31 : 0] plaintext_32 5); 6alu cal_1( 7 .in1(key_32), 8 .in2(plaintext_32) 9); 10always @* 11begin : cal_en 12 key_32 + plaintext_32 + key_32; 13end 14endmodule
alu.v
1`include "alu_ops.vh" 2`include "rv32_opcodes.vh" 3`include "cal.v" 4 5`default_nettype none 6 7module alu( 8 input wire [`ALU_OP_WIDTH-1:0] op, //4 bit extend 5 bit 9 input wire [`XPR_LEN-1:0] in1, 10 input wire [`XPR_LEN-1:0] in2, 11 output reg [`XPR_LEN-1:0] out 12 ); 13 always @(*) begin 14 case (op) 15 `ALU_OP_ADD : out = in1 + in2; 16 `ALU_OP_XOR : out = in1 ^ in2; 17 `ALU_OP_OR : out = in1 | in2; 18 `ALU_OP_AND : out = in1 & in2; 19 //cal add 20 `ALU_OP_cal : out = cal(in1,in2); 21 22 default : out = 0; 23 endcase // case op 24 end 25endmodule // alu 26`default_nettype wire
key_32 + plaintext_32 + key_32;
この行は何をしようとしていますか?

回答1件
あなたの回答
tips
プレビュー