[PATCH] Implement System Verilog $urandom and $urandom_range functions.
[iverilog.git] / net_modulo.cc
blob5ff3be9e4d4c216d93c478783422b9a22040bc9d
1 /*
2 * Copyright (c) 2000-2005 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: net_modulo.cc,v 1.9 2005/09/15 22:54:47 steve Exp $"
21 #endif
23 # include "config.h"
25 # include <typeinfo>
26 # include <iostream>
27 # include <iomanip>
28 # include <cassert>
30 # include "netlist.h"
31 # include "compiler.h"
34 * 0 -- Result
35 * 1 -- DataA
36 * 2 -- DataB
38 NetModulo::NetModulo(NetScope*s, perm_string n, unsigned wr,
39 unsigned wa, unsigned wb)
40 : NetNode(s, n, 3),
41 width_r_(wr), width_a_(wa), width_b_(wb)
43 pin(0).set_dir(Link::OUTPUT);
44 pin(0).set_name(perm_string::literal("Result"), 0);
45 pin(1).set_dir(Link::INPUT);
46 pin(1).set_name(perm_string::literal("DataA"), 0);
47 pin(2).set_dir(Link::INPUT);
48 pin(2).set_name(perm_string::literal("DataB"), 0);
51 NetModulo::~NetModulo()
55 unsigned NetModulo::width_r() const
57 return width_r_;
60 unsigned NetModulo::width_a() const
62 return width_a_;
65 unsigned NetModulo::width_b() const
67 return width_b_;
70 Link& NetModulo::pin_Result()
72 return pin(0);
75 const Link& NetModulo::pin_Result() const
77 return pin(0);
80 Link& NetModulo::pin_DataA()
82 return pin(1);
85 const Link& NetModulo::pin_DataA() const
87 return pin(1);
90 Link& NetModulo::pin_DataB()
92 return pin(2);
95 const Link& NetModulo::pin_DataB() const
97 return pin(2);
101 * $Log: net_modulo.cc,v $
102 * Revision 1.9 2005/09/15 22:54:47 steve
103 * Fix bug configuring NetModulo pins.
105 * Revision 1.8 2005/03/12 06:43:35 steve
106 * Update support for LPM_MOD.
108 * Revision 1.7 2004/02/18 17:11:56 steve
109 * Use perm_strings for named langiage items.
111 * Revision 1.6 2003/03/06 00:28:41 steve
112 * All NetObj objects have lex_string base names.
114 * Revision 1.5 2002/08/12 01:34:59 steve
115 * conditional ident string using autoconfig.
117 * Revision 1.4 2002/08/11 23:47:04 steve
118 * Add missing Log and Ident strings.