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.

Multi-port register file in HDL

Status
Not open for further replies.

Goran Dakov

Newbie level 5
Newbie level 5
Joined
Dec 18, 2013
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
66
q1: Do place and route tools synthesize multi-port register files with "write-first" read-during-write behaviour or are they restricted to only "undefined" read-during-write?
q2: In a super-scalar cpu would the multi-ported register files be synthesised ok by place-and-route tools or a specialised compiler is usually used?
 

That entirely depends on the HDL itself.

Here's a regfile that implies read during write = "old value"; please note that I'm rusty on 2D arrays/memories so this may not be syntactically perfect. :)

Code:
module regfile(  input clk,
                       input reset,

                       input [3:0] read_addr,
                       output [7:0] read_data,

                       input [3:0] write_addr,
                       input write_valid,
                       input [7:0] write_data );

reg [7:0] memory[0:15];

always @(posedge clk)
begin
  if( reset )
  begin
    read_data <= 8'hxx; // don't care
  end
  else
  begin
    if( read_valid )
    begin
      read_data <= memory[read_addr];
    end

    if( write_valid )
    begin
      memory[write_addr] <= write_data;
    end
  end
end

endmodule

And here's read during write behavior being "new value"; the only change is an additional conditional in the if( read_valid ) block:


Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
always @(posedge clk)
begin
  if( reset )
  begin
    read_data <= 8'hxx; // don't care
  end
  else
  begin
    if( read_valid )
    begin
      if( write_valid )
      begin
        read_data <= write_data; // intercept new data for RDW behavior "new value"
      end
      else
        read_data <= memory[read_addr];
      end
    end
 
    if( write_valid )
    begin
      memory[write_addr] <= write_data;
    end
  end
end
 
endmodule



Pretty sure that the number of ports that the regfile has makes a difference with respect to RDW behavior.

q2: I've synthesized multiported regfiles all the time in ISE/VIVADO & QUARTUS so I don't think a "specialized" compiler is needed.
 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top