Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Question about the code for register file access

Status
Not open for further replies.

sebas

Junior Member level 2
Joined
Oct 7, 2009
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,468
Hi,

A newbie's question, in the following code:

Code:
module reg_file
(
input wire clk,
input wire wr_en,
input wire [1:0] w_addr, r_addr,
input wire [7:O] w_data,
output wire [7:Ol r_data
)

reg [7:Ol array_reg [2**1:0] ;
always @(posedge clk)
	if (wr_en)
		array_reg [w_addrl <= w_data;
assign r_data = array_reg [r_addr];

endmodule

why is the writing done sequentially and the reading purely combinational? That is writing inside an always activated on the front edge of clk and reading in a continuous assignment.

Thanks
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top