Add a mark at simulation end for vcd/lxt/lxt2 files.
[iverilog.git] / net_udp.cc
blobc5d3df01f76cddfe95745c251db8294ebb7a2e6b
1 /*
2 * Copyright (c) 2000 Stephen Williams (steve@icarus.com)
3 * Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu>
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)
9 * any later version.
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 #ifdef HAVE_CVS_IDENT
21 #ident "$Id: net_udp.cc,v 1.10 2004/10/04 01:10:54 steve Exp $"
22 #endif
24 # include "config.h"
25 # include "compiler.h"
27 # include "netlist.h"
29 NetUDP::NetUDP(NetScope*s, perm_string n, unsigned pins, PUdp *u)
30 : NetNode(s, n, pins), udp(u)
32 pin(0).set_dir(Link::OUTPUT);
33 pin(0).set_name(perm_string::literal("O"), 0);
34 for (unsigned idx = 1 ; idx < pins ; idx += 1) {
35 pin(idx).set_dir(Link::INPUT);
36 pin(idx).set_name(perm_string::literal("I"), idx-1);
40 bool NetUDP::first(string&inp, char&out) const
42 table_idx = (unsigned) -1;
43 return next(inp, out);
46 bool NetUDP::next(string&inp, char&out) const
48 table_idx++;
50 if (table_idx >= udp->tinput.count())
51 return false;
53 if (is_sequential())
55 inp = string("") + udp->tcurrent[table_idx] + udp->tinput[table_idx];
56 assert(inp.length() == pin_count());
58 else
60 inp = udp->tinput[table_idx];
61 assert(inp.length() == (pin_count()-1));
64 out = udp->toutput[table_idx];
65 assert( (out == '0')
66 || (out == '1')
67 || (out == 'x')
68 || (is_sequential() && (out == '-')));
70 return true;
73 char NetUDP::get_initial() const
75 assert (is_sequential());
77 switch (udp->initial)
79 case verinum::V0:
80 return '0';
81 case verinum::V1:
82 return '1';
83 case verinum::Vx:
84 case verinum::Vz:
85 return 'x';
88 assert(0);
89 return 'x';
94 * $Log: net_udp.cc,v $
95 * Revision 1.10 2004/10/04 01:10:54 steve
96 * Clean up spurious trailing white space.
98 * Revision 1.9 2004/02/18 17:11:56 steve
99 * Use perm_strings for named langiage items.
101 * Revision 1.8 2003/03/06 00:28:42 steve
102 * All NetObj objects have lex_string base names.
104 * Revision 1.7 2002/08/12 01:34:59 steve
105 * conditional ident string using autoconfig.
107 * Revision 1.6 2001/07/25 03:10:49 steve
108 * Create a config.h.in file to hold all the config
109 * junk, and support gcc 3.0. (Stephan Boettcher)
111 * Revision 1.5 2001/04/24 02:23:58 steve
112 * Support for UDP devices in VVP (Stephen Boettcher)
114 * Revision 1.4 2001/04/22 23:09:46 steve
115 * More UDP consolidation from Stephan Boettcher.
117 * Revision 1.3 2000/12/15 01:24:17 steve
118 * Accept x in outputs of primitive. (PR#84)
120 * Revision 1.2 2000/11/04 06:36:24 steve
121 * Apply sequential UDP rework from Stephan Boettcher (PR#39)
123 * Revision 1.1 2000/03/29 04:37:11 steve
124 * New and improved combinational primitives.