Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the Testbench Code for the following device in System Verilog. // --Regfile-- module regfile(input logic clk, input logic we3, input logic [3:0] ra1, ra2,

Write the Testbench Code for the following device in System Verilog.

// --Regfile-- module regfile(input logic clk, input logic we3, input logic [3:0] ra1, ra2, wa3, input logic [31:0] wd3, r15, output logic [31:0] rd1, rd2); logic [31:0] rf[14:0]; // three ported register file // read two ports combinationally // write third port on rising edge of clock // register 15 reads PC + 8 instead always_ff @(posedge clk) if (we3) rf[wa3] <= wd3; assign rd1 = (ra1 == 4'b1111) ? r15 : rf[ra1]; assign rd2 = (ra2 == 4'b1111) ? r15 : rf[ra2]; endmodule

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions