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.

Read and writes at the same memory location

Status
Not open for further replies.

shiny1

Junior Member level 1
Joined
Aug 7, 2012
Messages
16
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,394
Hi,

Can we read and write from the same memory location in the same clock cycle. i.e., writing at the rising edge and reading at the falling edge from the same location. Is it possible to achieve?
regards
 

you cannot use dual edges inside an FPGA. But most FPGA memories are duel ported, so yet you can read and write on the same clock edge on the two different ports.
 
  • Like
Reactions: shiny1

    shiny1

    Points: 2
    Helpful Answer Positive Rating
Does it mean I can access same memory location for reading and writing in the same clock cycle through different ports... Correct me if am wrong . Thank you.
 

yes. Read up on your selected device archiecture.
 
  • Like
Reactions: shiny1

    shiny1

    Points: 2
    Helpful Answer Positive Rating
Can we read and write from the same memory location in the same clock cycle/.../

such example is compiled by quartus without warnings and [quartus] netlist simulation
shows possibility of writing on rising edge and then reading the same location
on falling clock edge;

Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
module dual_edge_ram
(
  input            clk, wr,
  input      [7:0] addr_in, addr_out,
  input      [7:0] d_in,
  output reg [7:0] d_out
);
 
reg [7:0] ram[0:255];
wire      rd_clk = ~clk;
 
 
 always @(posedge rd_clk)
   if ( wr ) ram[addr_in] <= d_in;
 
//always @(negedge clk)   
 always @(posedge rd_clk)
   d_out <= ram[addr_out];
 
endmodule



actually quartus inserts an inverter on the clock line and use
positive edges, like in the example, but it will accept also:
always @(negedge clk) d_out <= ram[addr_out];

j.a
 
  • Like
Reactions: shiny1

    shiny1

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top