regfile.v
来自「多周期处理器--verilog写的,欢迎大家来下载」· Verilog 代码 · 共 20 行
V
20 行
//Implementation of Register File 32-bitmodule regfile (input clk,input we3,input [4:0] ra1, ra2, wa3,input [31:0] wd3,output reg [31:0] rd1, rd2);reg [31:0] rf[31:0];// three ported register file// read two ports combinationally// write third port on rising edge of clock// register 0 hardwired to 0always @ (posedge clk)begin $display("<<wrenable=%b>><<regdstination=%b>><<content=%b>>",we3,wa3,wd3); if (we3) rf[wa3] <= wd3; rd1 <= (ra1 !=0) ? rf[ra1] : 0; rd2 <= (ra2 !=0) ? rf[ra2] : 0; end endmodule
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?