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.

how do I replace the reg to block ram?

Status
Not open for further replies.

kosen

Newbie level 1
Newbie level 1
Joined
Aug 31, 2007
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,300
infer ram with initial contents

hi ,all
I have a verilog code to do the ST image process.
There are 800 ,4bit data reg for one color ,ex:reg signed [4:0] eramB[799:0]
Final I will creat three reg , but it will Synthesis fail because over the Slices and LUTs.
So I want to replace the REG to BRAM.
In fact, I also use the ISE to gen the BRAM(RAMB16_S18) code.But I don't how to instead it in my code and how could I know it work corret? @@

below is the my simple verilog about the reg and declare, the last is the ISE gen code .

------------------------------------------------------
module threshold ( Ycon,//y-aixs
Xcon, //x-axis
rin, //R
//---output
rout,

);
input [7:0] Rin;
input [10:0] ucon;
input [8:0] decon;
//--------------OUTPUT
output [3:0] rout ;
reg [3:0] rout ;
reg signed [9:0] rth;
//------------integer
integer i;
reg signed [4:0] eramB[799:0];
//------------error reg
reg signed[4:0] k;
wire [9:0] er1temp = (decon>1) ? (eramB[0]*5 + eramB[1]*1 ) :0 ;
wire [9:0] er3temp = (decon>1) ? (eramB[ucon-1]*3+ eramB[ucon]*5 + eramB[ucon+1]*1) : 0 ;
wire [9:0] er5temp = (decon>1) ? (eramB[798]*3 + eramB[799]*5 ) :0 ;
wire [9:0] er7temp = k*7 ;

....
....
.....
endmodule
RAMB16_S18 #(
.INIT(18'h00000), // Value of output RAM registers at startup
.SRVAL(18'h000000), // Ouput value upon SSR assertion
.WRITE_MODE("WRITE_FIRST"), // WRITE_FIRST, READ_FIRST or NO_CHANGE

// The following INIT_xx declarations specify the initial contents of the RAM
// Address 0 to 255
.INIT_00(256'h0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000),
.INIT_01(256'h0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000),

...
) RAMB16_S18_inst (
.DO(DO), // 16-bit Data Output
.DOP(DOP), // 2-bit parity Output
.ADDR(ADDR), // 10-bit Address Input
.CLK(CLK), // Clock
.DI(DI), // 16-bit Data Input
.DIP(DIP), // 2-bit parity Input
.EN(EN), // RAM Enable Input
.SSR(SSR), // Synchronous Set/Reset Input
.WE(WE) // Write Enable Input
);
 

output register in block ram

XST can infer block RAM, but your example is missing many lines, so I can't compile it or guess what's wrong. Can you show us a complete example that can be compiled?

The XST User Guide chapter "HDL Coding Techniques" explains how write Verilog to infer block RAM without having to instantiate a RAMB16.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top