Hi,
Is there any way to set values to parameter or generic in Verilog/VHDL RTL code with the Quartus II? I want to change the parameters inside megacore without modifting RTL code. Thanks链接已复制
10 回复数
Here's by far the most common usage of it, which is used when a piece of IP targets a specific RAM type and the end user wants to force it to a different type:
http://www.altera.com/support/kdb/solutions/rd02172004_713.html?gsa_pos=6&wt.oss_r=1&wt.oss=m4k%20m-ramDigging an old one up here.
Does anybody now how this translates to assignments in the qsf? I'm trying to change the value of a top level block VHDL generic in different build revisions. Thanks.Yes changing a package in the qsf would be an option but we potentially have many variations (based on the generic) of the same build and hence many qsfs. So what we are going to do is set up the project with a bash script that changes the single paramater setting in some tcl accordingly, and then runs the tcl to set up the project.
I've got a top level called "fred_top" with a generic called "width" which by default is 8. What I try and do is change that value by setting the following in the qsf but unfortunaletly it doesn't seem to work.set_parameter -name width 16 -to fred_top
Any ideas appreciated.
i will see if i can test the Quartus parameters instead of VHDL packages
if you're really stuck you could make the bash script generate the VHDL package on the fly based on the parametrization (same .vhd name so no changes to .qsf)Pancake,
This is some code I knocked up to test it...
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity fred is
generic ( frog : integer := 1 );
port (
in1 : in std_ulogic_vector (3 downto 0);
in2 : in std_ulogic_vector (3 downto 0);
sel : in std_ulogic_vector (3 downto 0);
out1 : out std_ulogic_vector (3 downto 0));
end fred;
architecture RTL of fred is
--
component mx_comp_1
port(
in1 : in std_ulogic;
in2 : in std_ulogic;
sel : in std_ulogic;
out1 : out std_ulogic);
end component;
--
component mx_comp_2
port(
in1 : in std_ulogic;
in2 : in std_ulogic;
sel : in std_ulogic;
out1 : out std_ulogic);
end component;
begin
GEN: for n in 3 downto 0 generate
COND1 : if (frog = 1) generate
mx1g : mx_comp_1
port map (
in1 => in1(n),
in2 => in2(n),
sel => sel(n),
out1 => out1(n)
);
end generate;
COND2 : if (frog = 2) generate
mx2g : mx_comp_2
port map (
in1 => in1(n),
in2 => in2(n),
sel => sel(n),
out1 => out1(n)
);
end generate;
end generate;
end RTL;
If you manually change the frog generic from 1 to 2 it changes which mx_comp is generated in Quartus, as you would expect. Nw to do this is the qsf I used... set_parameter -name frog 2 -to fred
In this case fred is the top level. It did not work. Now either I'm doing something wrong or it's simply not working. Thanks for your effort on this.
It work's exactly as suggested above:
--- Quote Start --- set_parameter -name my_param my_value --- Quote End --- Please consider, that in VHDL parameters can be only set for the top entity, not down the hierarchies. Thus the set_parameter tcl command doesn't need/understand an entity name here.