data/full_repos/permissive/115487336/mycode/Mips/MonoCycle-Mips/branch.v
[Errno 2] No such file or directory: 'preprocess.output'
data/verilator_xmls/2b64b359-869a-4fcf-8df1-10bf38eab6a3.xml
module branch(
	input [31:0] now_addr,
	input br,
	input j_or_b,
	input regnzp,
	input [31:0] offset,
	output reg pcmux,
	output reg [31:0] addr
);

reg [31:0] tpof;

always@(*)
begin
	if(br==0)
	begin
		pcmux=0;
	end
	else
	begin
		tpof=offset<<2;
		
		if(j_or_b==1)
		begin
			addr=tpof;
			pcmux=1;
		end
		else
		begin
			if(regnzp)
			begin
				addr=now_addr+tpof+32'h4;
				pcmux=1;
			end
			else
				pcmux=0;
		end	
	end
end

endmodule
module branch(
	input [31:0] now_addr,
	input br,
	input j_or_b,
	input regnzp,
	input [31:0] offset,
	output reg pcmux,
	output reg [31:0] addr
);


reg [31:0] tpof;

always@(*)
begin
	if(br==0)
	begin
		pcmux=0;
	end
	else
	begin
		tpof=offset<<2;
		
		if(j_or_b==1)
		begin
			addr=tpof;
			pcmux=1;
		end
		else
		begin
			if(regnzp)
			begin
				addr=now_addr+tpof+32'h4;
				pcmux=1;
			end
			else
				pcmux=0;
		end	
	end
end

endmodule