data/full_repos/permissive/118303050/src/lab_3/datapath.v
1: b"%Error: data/full_repos/permissive/118303050/src/lab_3/datapath.v:42: Cannot find file containing module: 'flopr'\n flopr #(32) pcreg(clk,rst,pcnext,pc);\n ^~~~~\n        ... Looked in:\n             data/full_repos/permissive/118303050/src/lab_3,data/full_repos/permissive/118303050/flopr\n             data/full_repos/permissive/118303050/src/lab_3,data/full_repos/permissive/118303050/flopr.v\n             data/full_repos/permissive/118303050/src/lab_3,data/full_repos/permissive/118303050/flopr.sv\n             flopr\n             flopr.v\n             flopr.sv\n             obj_dir/flopr\n             obj_dir/flopr.v\n             obj_dir/flopr.sv\n%Error: data/full_repos/permissive/118303050/src/lab_3/datapath.v:43: Cannot find file containing module: 'adder'\n adder pcadd1(pc,32'b100,pcplus4);\n ^~~~~\n%Error: data/full_repos/permissive/118303050/src/lab_3/datapath.v:44: Cannot find file containing module: 'sl2'\n sl2 immsh(signimm,signimmsh);\n ^~~\n%Error: data/full_repos/permissive/118303050/src/lab_3/datapath.v:45: Cannot find file containing module: 'adder'\n adder pcadd2(pcplus4,signimmsh,pcbranch);\n ^~~~~\n%Error: data/full_repos/permissive/118303050/src/lab_3/datapath.v:46: Cannot find file containing module: 'mux2'\n mux2 #(32) pcbrmux(pcplus4,pcbranch,pcsrc,pcnextbr);\n ^~~~\n%Error: data/full_repos/permissive/118303050/src/lab_3/datapath.v:47: Cannot find file containing module: 'mux2'\n mux2 #(32) pcmux(pcnextbr,{pcplus4[31:28],instr[25:0],2'b00},jump,pcnext);\n ^~~~\n%Error: data/full_repos/permissive/118303050/src/lab_3/datapath.v:49: Cannot find file containing module: 'regfile'\n regfile rf(clk,regwrite,instr[25:21],instr[20:16],writereg,result,srca,writedata);\n ^~~~~~~\n%Error: data/full_repos/permissive/118303050/src/lab_3/datapath.v:50: Cannot find file containing module: 'mux2'\n mux2 #(5) wrmux(instr[20:16],instr[15:11],regdst,writereg);\n ^~~~\n%Error: data/full_repos/permissive/118303050/src/lab_3/datapath.v:51: Cannot find file containing module: 'mux2'\n mux2 #(32) resmux(aluout,readdata,memtoreg,result);\n ^~~~\n%Error: data/full_repos/permissive/118303050/src/lab_3/datapath.v:52: Cannot find file containing module: 'signext'\n signext se(instr[15:0],signimm);\n ^~~~~~~\n%Error: data/full_repos/permissive/118303050/src/lab_3/datapath.v:54: Cannot find file containing module: 'mux2'\n mux2 #(32) srcbmux(writedata,signimm,alusrc,srcb);\n ^~~~\n%Error: data/full_repos/permissive/118303050/src/lab_3/datapath.v:55: Cannot find file containing module: 'alu'\n alu alu(srca,srcb,alucontrol,aluout,overflow,zero);\n ^~~\n%Error: Exiting due to 12 error(s)\n"
module datapath(
	input wire clk,rst,
	input wire memtoreg,pcsrc,
	input wire alusrc,regdst,
	input wire regwrite,jump,
	input wire[2:0] alucontrol,
	output wire overflow,zero,
	output wire[31:0] pc,
	input wire[31:0] instr,
	output wire[31:0] aluout,writedata,
	input wire[31:0] readdata
    );
	
	wire[4:0] writereg;
	wire[31:0] pcnext,pcnextbr,pcplus4,pcbranch;
	wire[31:0] signimm,signimmsh;
	wire[31:0] srca,srcb;
	wire[31:0] result;

	flopr #(32) pcreg(clk,rst,pcnext,pc);
	adder pcadd1(pc,32'b100,pcplus4);
	sl2 immsh(signimm,signimmsh);
	adder pcadd2(pcplus4,signimmsh,pcbranch);
	mux2 #(32) pcbrmux(pcplus4,pcbranch,pcsrc,pcnextbr);
	mux2 #(32) pcmux(pcnextbr,{pcplus4[31:28],instr[25:0],2'b00},jump,pcnext);

	regfile rf(clk,regwrite,instr[25:21],instr[20:16],writereg,result,srca,writedata);
	mux2 #(5) wrmux(instr[20:16],instr[15:11],regdst,writereg);
	mux2 #(32) resmux(aluout,readdata,memtoreg,result);
	signext se(instr[15:0],signimm);

	mux2 #(32) srcbmux(writedata,signimm,alusrc,srcb);
	alu alu(srca,srcb,alucontrol,aluout,overflow,zero);

endmodule
module datapath(
	input wire clk,rst,
	input wire memtoreg,pcsrc,
	input wire alusrc,regdst,
	input wire regwrite,jump,
	input wire[2:0] alucontrol,
	output wire overflow,zero,
	output wire[31:0] pc,
	input wire[31:0] instr,
	output wire[31:0] aluout,writedata,
	input wire[31:0] readdata
    );

	
	wire[4:0] writereg;
	wire[31:0] pcnext,pcnextbr,pcplus4,pcbranch;
	wire[31:0] signimm,signimmsh;
	wire[31:0] srca,srcb;
	wire[31:0] result;

	flopr #(32) pcreg(clk,rst,pcnext,pc);
	adder pcadd1(pc,32'b100,pcplus4);
	sl2 immsh(signimm,signimmsh);
	adder pcadd2(pcplus4,signimmsh,pcbranch);
	mux2 #(32) pcbrmux(pcplus4,pcbranch,pcsrc,pcnextbr);
	mux2 #(32) pcmux(pcnextbr,{pcplus4[31:28],instr[25:0],2'b00},jump,pcnext);

	regfile rf(clk,regwrite,instr[25:21],instr[20:16],writereg,result,srca,writedata);
	mux2 #(5) wrmux(instr[20:16],instr[15:11],regdst,writereg);
	mux2 #(32) resmux(aluout,readdata,memtoreg,result);
	signext se(instr[15:0],signimm);

	mux2 #(32) srcbmux(writedata,signimm,alusrc,srcb);
	alu alu(srca,srcb,alucontrol,aluout,overflow,zero);

endmodule