13.07.2015 Views

XPLA Designer v2.1 User's Manual

XPLA Designer v2.1 User's Manual

XPLA Designer v2.1 User's Manual

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Variables are shorthand references to groups of other identifiers. Lines 16 and 17 ofFigure 22 show examples of variables. The identifiers ca15 through ca0 and cb15 throughcb0 declared in lines 13 and 14 represent the 16 bits of each counter and are assigned topins. The variables ca and cb are assigned to the strings of counter bits and can be used tosimplify the logic description section. Consider line 21 of Figure 22. Because of thevariable declaration on line 16, clocks can be assigned to all the counter outputs with thesingle lineca.clk = clk;.If the variable ca had not been declared, line 22 would have to be replaced with thefollowing 16 lines to achieve the same result:ca15.clk = clk;ca14.clk = clk;ca13.clk = clk;ca12.clk = clk;ca11.clk = clk;ca10.clk = clk;ca9.clk = clk;ca8.clk = clk;ca7.clk = clk;ca6.clk = clk;ca5.clk = clk;ca4.clk = clk;ca3.clk = clk;ca2.clk = clk;ca1.clk = clk;ca0.clk = clk;Macro FunctionsMacro functions are useful for including functions in a PHDL file several times withouthaving to retype the code each time the function is used. One can think of a macro as apre-defined function that can be called many times, each time with different signals. Forexample, if a design used three separate eight bit to three bit encoders, you would notwant to have to retype the encoding definition three separate times. You could insteaddefine the encoding in a macro and then call the macro three separate times with threeseparate sets of signals. The following example illustrates this concept.40

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!