Digital Signal Processing Reference
In-Depth Information
Declaring the I/O Pins
The input pins, PB1 and PB2, and the output pin, LED, need to be specified in
the arguments of the Module statement and Port declaration. Since there are no
'inout pins', 'wire', 'reg', or 'integer' declarations, or Always statements in
this design, remove all of these lines. The source file should now look similar
to Figure 1.24.
Figure 1.24 Verilog module declaration text.
Setting up the Behavioral Code
Click the mouse to just before the line starting with “endmodule”. (We will be
inserting another template here.) Following the earlier procedure for selecting
a Verilog template (start with a right click), select a Constructs Module
Items Continuous Assignment . (A single assign statement will specify the
internal logic of this design.) The syntax for a Continuous Assignment
Statement appears in the text window after the other text. (You can now see
why the template is left highlighted - had you not placed your cursor first, text
would have appeared at your last cursor position. If you do misplace the
template, hitting the delete key removes the highlighted text.)
Editing the Continuous Assignment Statement
Change the <net lvalue> in the assign statement to "LED" and <value> to:
! ( ! PB1 | ! PB2 );
Verilog is based on C and "|" (vertical line) is the bit wise OR operator. The "!"
(exclamation point) is the NOT operator. Delete the remaining comment lines
that start with "//". Delete the ";" at the end of the assign LED statement (This
causes a deliberate syntax error that will be detected and fixed later.) The file
should now appear as in Figure 1.25.
Search WWH ::




Custom Search