Check for extra digits in sized binary, octal and hex constants.
[iverilog.git] / async.cc
blob3d283b9c6d5b57bfd94257ebde68e3ce9fee1934
1 /*
2 * Copyright (c) 2002 Stephen Williams (steve@icarus.com)
4 * This source code is free software; you can redistribute it
5 * and/or modify it in source code form under the terms of the GNU
6 * General Public License as published by the Free Software
7 * Foundation; either version 2 of the License, or (at your option)
8 * any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19 #ifdef HAVE_CVS_IDENT
20 #ident "$Id: async.cc,v 1.7 2004/01/18 23:26:54 steve Exp $"
21 #endif
23 # include "config.h"
25 # include "functor.h"
26 # include "netlist.h"
27 # include <assert.h>
29 bool NetAssign::is_asynchronous()
31 return true;
34 bool NetCondit::is_asynchronous()
36 return false;
40 * NetEvWait statements come from statements of the form @(...) in the
41 * Verilog source. These event waits are considered asynchronous if
42 * all of the events in the list are ANYEDGE, and all the inputs to
43 * the statement are included in the sensitivity list. If any of the
44 * events are posedge or negedge, the statement is synchronous
45 * (i.e. an edge-triggered flip-flop) and if any of the inputs are
46 * unaccounted for in the sensitivity list then the statement is a
47 * latch.
49 bool NetEvWait::is_asynchronous()
51 /* The "sense" set contains the set of Nexa that are in the
52 sensitivity list. We also require that the events are all
53 level sensitive, but the nex_async_ method takes care of
54 that test. */
55 NexusSet*sense = new NexusSet;
56 for (unsigned idx = 0 ; idx < nevents_ ; idx += 1) {
57 NexusSet*tmp = event(idx)->nex_async_();
58 if (tmp == 0) {
59 delete sense;
60 return false;
63 sense->add(*tmp);
64 delete tmp;
67 NexusSet*inputs = statement_->nex_input();
69 if (! sense->contains(*inputs)) {
70 delete sense;
71 delete inputs;
72 return false;
75 delete sense;
76 delete inputs;
78 /* If it passes all the other tests, then this statement is
79 asynchronous. */
80 return true;
83 bool NetProc::is_asynchronous()
85 return false;
88 bool NetProcTop::is_asynchronous()
90 if (type_ == NetProcTop::KINITIAL)
91 return false;
93 return statement_->is_asynchronous();
97 * $Log: async.cc,v $
98 * Revision 1.7 2004/01/18 23:26:54 steve
99 * The is_combinational function really need not recurse.
101 * Revision 1.6 2003/12/20 00:33:39 steve
102 * More thorough check that NetEvWait is asynchronous.
104 * Revision 1.5 2003/09/04 20:28:05 steve
105 * Support time0 resolution of combinational threads.
107 * Revision 1.4 2002/08/18 22:07:16 steve
108 * Detect temporaries in sequential block synthesis.
110 * Revision 1.3 2002/08/12 01:34:58 steve
111 * conditional ident string using autoconfig.
113 * Revision 1.2 2002/07/04 00:24:16 steve
114 * initial statements are not asynchronous.
116 * Revision 1.1 2002/06/30 02:21:31 steve
117 * Add structure for asynchronous logic synthesis.