⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pc.v

📁 A small MIPS R2000 implementation in VHDL
💻 V
字号:
module PC(ALUout, Inst, reset, PCsel, PCld, clk, PC);

  input	[31:0] ALUout;
  input	[31:0] Inst;
  input	reset, PCsel, PCld, clk;
  output  	[31:0] PC;

  reg  [31:0] PC;
  wire [31:0] src;

  // first we select where the PC's new value is coming from: 
  // 1. the output of the ALU after the PC is incremented, or
  // 2. the value from a J instruction padded with leading 0s
  
  assign src = PCsel ? ALUout : {6'b000000, Inst[25:0]};
  
  // the PC can be reset or loaded with a new value when PCld is asserted
  
  always @(posedge clk) begin
    if (reset) PC = 32'h00000000;
    else 
      if (PCld) PC = src;
  end

endmodule

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -