代码拉取完成,页面将自动刷新
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2017/11/02 14:20:09
// Design Name:
// Module Name: regfile
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module regfile(
input wire clk,
input wire we3,
input wire[4:0] ra1,ra2,wa3,
input wire[31:0] wd3,
output wire[31:0] rd1,rd2
);
reg [31:0] rf[31:0];
wire [31:0] s0;
wire [31:0] ra;
wire [31:0] a0;
wire [31:0] a1;
always @(posedge clk) begin
if(we3) begin
rf[wa3] <= wd3;
end
end
assign rd1 = (ra1 != 0) ? rf[ra1] : 0;
assign rd2 = (ra2 != 0) ? rf[ra2] : 0;
assign ra = rf[31];
assign s0 = rf[16];
assign a0 = rf[4];
assign a1 = rf[5];
endmodule
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。