Questions about multiple rom instances in Quartus II
Feb 16, 2005 5 Replies
J
John Rible
I'm using Verilog under Quartus 4.1sp2 to build a model of a custom part that has 25 identical (more-or-less) sub-modules, each with a small rom. Working bottom-up I built and tested the submodule: no problems. I used the wizard to build the rom code, specifing a .hex file for initialization.
I then created the top module with the 25 instances of the rom, but could not find any way to specify 25 UNIQUE .hex files for the roms. An Altera service request was not helpful except to get to the essence of the problem. Then I built a 4 sub-module test model, and, by hand, created 4 differently named copies of the rom module, renaming the .hex file specified in it.
That worked, but there has to be a simpler way! Question 1: what is it?
Some of the sub-module's outputs, connected only to other sub-modules, are the inverted contents of a register. I got the correct values for the sub-module test, but the inverters were 'hidden' by synthesis, even when I specified 'firm' hierarchy boundaries. The execution of the custom part assumes the inversion, and I've got to include it. Question 2: How?
Thanks, John
Didn't find your answer? Ask the community — no account required.
S
Subroto Datta
Hi John,
You will need to expose the parameter that is used for the .hex initialization file. The MegaWizard-generated Verilog file will have a line saying defparam .INIT_FILE = "foo.hex"; that parameter needs to be added to the MegaWizard-generated module and passed down. Then assign a unique value for that parameter to each instantiation of the wizard-generated ROM sub-module.
As for the question on inversions: all our blocks have programmable inversions on the inputs, so we allow inverts to be absorbed across hierarchy boundaries. The solution would be to insert an LCELL buffer to prevent the programmable inversion being propagated.
and this will prevent the inversion propagating. However, It will use up an LE.
Hope this helps,
Subroto Datta
Altera Corp.
J
John Rible
I've already tried using defparam (without adding it to the top file) and got: Error: Verilog HDL or VHDL error at c18m.v(78): Unconverted VERI-2009: no support for cross-hierarchy defparam id c.RS.m.altsyncram_component.init_file
Tomorrow I'll 'expose' the parameter. Also, Verilog 1995 didn't support string parameters; is that the problem?
Thanks a lot!
-John
S
Subroto Datta
Hi John,
The reason for the error message is that you are trying to use a cross-hierarchy defparam, which means setting aparameter on an instance several levels deep in the hierarchy. That is not supported today -- you can only set parameters on a module you are instantiating, not on any of its children. Instead, add a new parameter to the megawizard wrappper and pass that down. An example of a modified altsyncram file, with the edited lines marked with // EDIT. is shown below:
// ============================================================ // File Name: my_altsyncram.v // Megafunction Name(s): // altsyncram // ============================================================ // ************************************************************ // THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! // // 5.0 Internal Build 111 02/14/2005 SJ Full Version // ************************************************************
//Copyright (C) 1991-2005 Altera Corporation //Your use of Altera Corporation's design tools, logic functions //and other software and tools, and its AMPP partner logic //functions, and any output files any of the foregoing //(including device programming or simulation files), and any //associated documentation or information are expressly subject //to the terms and conditions of the Altera Program License //Subscription Agreement, Altera MegaCore Function License //Agreement, or other applicable license agreement, including, //without limitation, that your use is for the sole purpose of //programming logic devices manufactured by Altera and sold by //Altera or its authorized distributors. Please refer to the //applicable agreement for further details.
With regard to your question on string parameter: Verilog 1995 does support string parameters, so this is not an issue.
Hope this helps, Subroto Datta Altera Corp.
"John Rible" wrote in message news: snipped-for-privacy@enews4.newsguy.com...
J
John Rible
Subroto-
Tried it LATE last night. It works. And now the error message makes sense; is this difference from the Verilog LRM documented anywhere?
Thank you,
-John
Subroto Datta wrote:
...snip...
V
Vaughn Betz
Hi John,
In case you don't have the code all sorted yet, here's a tutorial on how to change the megawizard generated module to pass down the hex file parameter you need (thanks to one of our megafunction gurus):
You need to parameterize the wizard generated blackbox module. By default, the wizard generated module is fully customized according to the user selection in the wizard.
If you need to instantiate multiple instances which are variations of a base module, you can parameterize the variation in the base module.
For example, the following would be a typical wizard generated ROM module.
module myrom (
address,
clock,
q);
input [4:0] address;
input clock;
output [7:0] q;
wire [7:0] sub_wire0;
wire [7:0] q = sub_wire0[7:0];
altsyncram altsyncram_component (
.clock0 (clock),
...
...
.q_a(sub_wire0));
defparam
altsyncram_component.operation_mode = "ROM",
....
....
altsyncram_component.init_file = "test.mif",
....
You can parameterize the above module by changing it to the following (I highlighted the change in red)
module myrom (
address,
clock,
q);
input [4:0] address;
input clock;
output [7:0] q;
parameter mif_file = "test.mif";
wire [7:0] sub_wire0;
wire [7:0] q = sub_wire0[7:0];
altsyncram altsyncram_component (
.clock0 (clock),
...
...
.q_a(sub_wire0));
defparam
altsyncram_component.operation_mode = "ROM",
....
....
altsyncram_component.init_file = mif_file,
....
And now they can instantiate the instance with different mif_file on the upper level source.
Join the Discussion
Have something to add? Share your thoughts — no account required.
Didn't find your answer?
Ask the community — no account required
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.