3 ; Copyright (c) 2001 Stephen Williams (steve@icarus.com)
5 ; This source code is free software; you can redistribute it
6 ; and/or modify it in source code form under the terms of the GNU
7 ; General Public License as published by the Free Software
8 ; Foundation; either version 2 of the License, or (at your option)
11 ; This program is distributed in the hope that it will be useful,
12 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ; GNU General Public License for more details.
16 ; You should have received a copy of the GNU General Public License
17 ; along with this program; if not, write to the Free Software
18 ; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20 ; This example shows how to wire up a simple adder. The code below is
21 ; like what might be generated from the Verilog:
25 ; wire [3:0] Q = A + B;
30 ; #1 $display("%b %b = %b", A, B, Q);
34 ; Notice the use of the .arith/sum statement, including the specification
35 ; of the width (4 bits) and the order that the bits of the operands are
36 ; passed to the statement.
44 add .arith/sum 4, A[0], A[1], A[2], A[3], B[0], B[1], B[2], B[3];
46 Q .net "Q", 3, 0, add[0], add[1], add[2], add[3];
59 %vpi_call "$display", "%b + %b == %b", A, B, Q;