我是靠谱客的博主 坚强书包,这篇文章主要介绍cpu之pc_reg,现在分享给大家,希望可以做个参考。

module pc_reg(
	input wire clk,
	input wire rst,
	input wire stall_id,
	input wire jump,
	input wire[1:0] stall_branch_t,
	input wire[31:0] pc1,
	input wire[31:0] pc2,//专门为跳转指令设置的
	output reg[31:0] pc
);

always @(posedge clk) begin
	if (rst==1'b1) begin
		pc=32'h0;
		
	end else begin
		if (jump!=1'b1) begin
			if (stall_id==1'b0) begin
			if (stall_branch_t==2'b10) begin 
				pc <= pc1-32'h4;
			end else begin
				pc<=pc1;
			end
		end else begin
			pc <= pc1-32'h4;
		end
			
		end else begin
			pc <= pc2;
		end
		
	end
	
end

endmodule

最后

以上就是坚强书包最近收集整理的关于cpu之pc_reg的全部内容,更多相关cpu之pc_reg内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(55)

评论列表共有 0 条评论

立即
投稿
返回
顶部