- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
............
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
with a mif or hex you can pre set a memory content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Alexandre,
I've checked your suggestion, but what if I've 2 memories? Apparently, mif and hex just assign width and depth. How to appoint mif A and mif B?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Besides that,
I've RAM infer, build in my project. Can I save a data on it in the same way with mif and hex??
module SRAM_INFERS(CLK, WA, WE, DI, RA, DO, RA0, DO0, RA1, DO1, RA2, DO2, RA3, DO3);
input CLK;
/* 256 bit Write port */
input WE;
input WA;
input DI;
/* 256 bit Read port */
input RA;
input DO;
/* 8 bit Read ports */
input RA0, RA1;
input RA2, RA3;
output DO0, DO1;
output DO2, DO3;
wire DO0_tmp, DO1_tmp, DO2_tmp, DO3_tmp, DO_tmp;
reg DO0, DO1;
reg DO2, DO3;
/* Memory */
reg Mem ;
always @(posedge CLK)
begin
if(WE)
Mem = DI;
end
assign DO_tmp = Mem;
assign DO0_tmp = Mem];
assign DO1_tmp = Mem];
assign DO2_tmp = Mem];
assign DO3_tmp = Mem];
/* Subfield Extraction for 8 bit Read */
always @(DO0_tmp or RA0)
begin
casex(RA0)
5'b11111 : DO0 = DO0_tmp;
5'b11110 : DO0 = DO0_tmp;
5'b11101 : DO0 = DO0_tmp;
5'b11100 : DO0 = DO0_tmp;
5'b11011 : DO0 = DO0_tmp;
.
.
.
.
end
endmodule
regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That won't infer RAM due to asynchronous read.
That said, you can initialize the RAM contents with a "inital" block and a $readmem function to read data from a file. Another way is to use a ATLSYNCRAM function and point the INIT_FILE parameter to a .MIF or .HEX file.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
use the mega wizard to create the memory.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page