- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Forum,
I'd like to put a subsystem on a PLD which is a lookup table pretending to be the output of an ADC. I use the following verilog to initialize the lookup table. `define W 10 /* ADC bit width */ `define N 40 /* modulo count */ reg [2*W-1:0] count_to_volt[0:N-1]/* synthesis ram_init_file = "memarray3.mif" */; However, I'd really like 4 channels, reg [2*W-1:0] count_to_volt_channel[0:3][0:N-1]/* synthesis What goes here? */; but I don't know how to initialize the above 2-d memory array. At present my solution is just to use the first form four times with names count_to_volt1,...,count_to_volt4, but this is messy and it would be neater to use the 2-d memory. So, how do I persuade Quartus to initialize a 2-d memory? Yours sincerely StephenLink Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quartus can compreend farily sophisticated initial blocks.
Something like this should do the trick: integer i, j; initial begin for(i = 0; i < 4; i = i+1) begin for(j = 0; j < N; j = j + 1) begin count_to_volt[i][j] = something end end end- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear rbugalho,
That's very interesting because I did not know that one could use initial blocks in Quartus. Is this a functionality that has recently been added? Hitherto, I had guessed that the reason for .mif files was because Quartus did not understand initial blocks. Yours sincerely Stephen- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear rbugalho,
Forget my last reply, I've just read the section entitled "Specifying Initial Memory Contents at Power-Up" in Volume I of the Quartus II handbook where it explains that Quartus can create a .mif file from an initial block for inferred memory. Yours sincerely Stephen
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