Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
17 years ago

Can parameter or generic be set from Quartus II?

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 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    In the Assignment Editor, select "Parameters" near the bottom of the "Category" list. I think this will override parameters explicitly set in the RTL, but I don't remember for sure.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Brad and Rysc,

    I appreciate your answer. It looks work well.

    Regards
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Digging 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.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    i've used VHDL packages for that (you could call in different packages with the .qsf or other build script)

    however, here's the parameter in the .qsf:

    set_parameter -name my_param my_value
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    FvM brilliant, thanks.

    It seems all I had to do is drop the -to option.

    Just using this works...

    set_parameter -name frog 2 

    Thanks.