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.

Logic scope coding approach

Status
Not open for further replies.
The following gave me register array. Why ?


Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
`include "define.v"
 
module memory_block (clk, write_enable, waddr, raddr, data_write, data_read);
 
input clk, write_enable;
input [(`ADDR_WIDTH-1) : 0] waddr;
input [(`ADDR_WIDTH-1) : 0] raddr;
input [(`DATA_WIDTH-1) : 0] data_write;  // data to be written into memory
output reg [(`DATA_WIDTH-1) : 0] data_read;  // data read out from memory
 
reg [(`DATA_WIDTH-1) : 0] memory [(`MEMORY_SIZE-1) : 0];
 
always @(posedge clk)
begin
     data_read <= memory[raddr];
     
    if (write_enable)   
        memory[waddr] <= data_write;
end
 
endmodule

 

The tools can choose the implementation. When MEMORY_SIZE is low it might be possible that other resources are less optimal. If the device doesn't have distributed RAM for example, it would not be efficient to use a block ram for a small number of elements.

The tools can also be very restrictive on coding style. Perhaps the second index needs to be [0 : MEMORY_SIZE-1].
 
The tools can choose the implementation. When MEMORY_SIZE is low it might be possible that other resources are less optimal. If the device doesn't have distributed RAM for example, it would not be efficient to use a block ram for a small number of elements.

Thanks. Larger MEMORY_SIZE helps to infer RAM.

Screenshot from 2017-09-21 11-02-24.png
 

Use a RAM_STYLE attribute on the memory array to force block RAM usage.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top