register_rs2,
dc.immediate))
+ ali = Instance("cpu_alu", name="alu",
+ i_funct7 = dc.funct7,
+ i_funct3 = dc.funct3,
+ i_opcode = dc.opcode,
+ i_a = alu_a,
+ i_b = alu_b,
+ o_result = alu_result
+ )
+ self.specials += ali
+
+
if __name__ == "__main__":
example = CPU()
print(verilog.convert(example,
"""
- cpu_alu alu(
- .funct7(decoder_funct7),
- .funct3(decoder_funct3),
- .opcode(decoder_opcode),
- .a(alu_a),
- .b(alu_b),
- .result(alu_result)
- );
-
wire [31:0] lui_auipc_result = decoder_opcode[5] ? decoder_immediate : decoder_immediate + fetch_output_pc;
assign fetch_target_pc[31:1] = ((decoder_opcode != `opcode_jalr ? fetch_output_pc[31:1] : register_rs1[31:1]) + decoder_immediate[31:1]);