Retro prof in the lab University of Washington Computer Science & Engineering
 CSE 378 Spring 2006
  CSE Home   About Us    Search    Contact Info 

 Using Parameters in Active-HDL

This is a fast and dirty introduction to the concept of parameters. If you think you know about parameters, you can probably skip this for now.

What's a parameter

At its most basic, a parameter is a constant.  It simply represents a static value that you want access to in your design. The reality is that a parameter is even better than a constant, because it can be modified by external sources. In other words, the value of a constant in module A can be changed by any module B.  Let's look at an example

1   module print;
2     parameter STRING = "";
3     initial
4       $display("%s\n",STRING);
5   endmodule
6            
7   module howdy;
8     print #(.STRING("Hello")) HELLO;
9     print WORLD;
10            
11     defparam WORLD.STRING = "WORLD";
12   endmodule

What we did here was declare a module called print in lines 1-5. Then, in module howdy we instantiate 2 copies of print, called HELLO and WORLD.  In line 8, the #(.STRING("Hello"))  means "set parameter STRING = 'Hello''" for the current instance which is HELLO.  We do the same thing in a different way down at line 11, where we redefine the value of STRING within WORLD.

Using parameters in block diagrams

There are many cases where you may want to set parameters from within a block diagram. There are two methods, and the one you choose depends on the circumstances.  

Setting Parameter using the Properties menu:

  1. Right-click on the symbol and go to Properties
  2. Select the Parameters Tab at the top
  3. Enter the values for parameters you want to update

Using embedded Parameters:

  1. Find the menu item between the ports menu and the GND/VDD menu
  2. scroll down to the button with an M
  3. Use the cursor to draw a box on your diagram
  4. Type your parameter statement into the green box as though it was normal Verilog.

Wrapup:

The component library is heavily parameterized, so it's important that you understand how to use this feature of the language.  If this description is unclear, please contact us cse378-tas@cs.washington.edu


CSE logo Computer Science & Engineering
University of Washington
Box 352350
Seattle, WA  98195-2350
(206) 543-1695 voice, (206) 543-2969 FAX
[comments to Shen]