您的位置:首页 > 其它

cpu之pc_reg

2017-12-18 15:13 162 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  branch pc cpu
相关文章推荐