Remove dead functor code.
This commit is contained in:
parent
e9bf021f6c
commit
99aff5f10b
|
|
@ -16,7 +16,7 @@
|
|||
# 59 Temple Place - Suite 330
|
||||
# Boston, MA 02111-1307, USA
|
||||
#
|
||||
#ident "$Id: Makefile.in,v 1.66 2005/04/24 20:07:25 steve Exp $"
|
||||
#ident "$Id: Makefile.in,v 1.67 2005/04/28 04:59:53 steve Exp $"
|
||||
#
|
||||
#
|
||||
SHELL = /bin/sh
|
||||
|
|
@ -85,7 +85,7 @@ O = main.o parse.o parse_misc.o lexor.o arith.o bufif.o compile.o concat.o \
|
|||
dff.o functor.o npmos.o part.o reduce.o resolv.o stop.o symbols.o \
|
||||
ufunc.o codes.o \
|
||||
vthread.o schedule.o statistics.o tables.o udp.o vvp_net.o memory.o \
|
||||
force.o event.o logic.o delay.o words.o $V
|
||||
event.o logic.o delay.o words.o $V
|
||||
|
||||
ifeq (@WIN32@,yes)
|
||||
# Under Windows (mingw) I need to make the ivl.exe in two steps.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* $Id: README.txt,v 1.63 2005/04/24 20:07:26 steve Exp $
|
||||
* $Id: README.txt,v 1.64 2005/04/28 04:59:53 steve Exp $
|
||||
*/
|
||||
|
||||
VVP SIMULATION ENGINE
|
||||
|
|
@ -553,7 +553,7 @@ that value. However, there are times when the value of a functor
|
|||
task, the %force/link instruction exists:
|
||||
|
||||
%force/link <dst>, <src> ;
|
||||
%release/link <dst> ;
|
||||
%release/link <dst>, <src> ;
|
||||
|
||||
This causes the output of the node <src> to be linked to the force
|
||||
input of the <dst> .var/.net node. When linked, the output functor
|
||||
|
|
@ -564,7 +564,7 @@ node. The matching %release/link instruction removes the link (a
|
|||
The instructions:
|
||||
|
||||
%cassign/link <dst>, <src> ;
|
||||
%deassign/link <dst> ;
|
||||
%deassign/link <dst>, <src> ;
|
||||
|
||||
are the same concept, but for the continuous assign port.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2003 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2005 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: compile.cc,v 1.197 2005/04/24 20:07:26 steve Exp $"
|
||||
#ident "$Id: compile.cc,v 1.198 2005/04/28 04:59:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "arith.h"
|
||||
|
|
@ -27,7 +27,6 @@
|
|||
# include "resolv.h"
|
||||
# include "udp.h"
|
||||
# include "memory.h"
|
||||
# include "force.h"
|
||||
# include "symbols.h"
|
||||
# include "codes.h"
|
||||
# include "schedule.h"
|
||||
|
|
@ -635,7 +634,6 @@ void compile_init(void)
|
|||
sym_vpi = new_symbol_table();
|
||||
|
||||
sym_functors = new_symbol_table();
|
||||
functor_init();
|
||||
|
||||
sym_codespace = new_symbol_table();
|
||||
codespace_init();
|
||||
|
|
@ -808,21 +806,6 @@ void const_functor_s::set(vvp_ipoint_t p, bool, unsigned val, unsigned)
|
|||
assert(0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static vvp_ipoint_t make_const_functor(unsigned val,
|
||||
unsigned str0,
|
||||
unsigned str1)
|
||||
{
|
||||
vvp_ipoint_t fdx = functor_allocate(1);
|
||||
functor_t obj = new const_functor_s(str0, str1);
|
||||
functor_define(fdx, obj);
|
||||
|
||||
obj->put_oval(val, false);
|
||||
|
||||
return fdx;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Lookup a functor[idx] and save the ipoint in *ref. */
|
||||
|
||||
#if 0
|
||||
|
|
@ -1109,31 +1092,6 @@ void compile_resolver(char*label, char*type, unsigned argc, struct symb_s*argv)
|
|||
free(argv);
|
||||
}
|
||||
|
||||
void compile_force(char*label, struct symb_s signal,
|
||||
unsigned argc, struct symb_s*argv)
|
||||
{
|
||||
#if 0
|
||||
vvp_ipoint_t ifofu = functor_allocate(argc);
|
||||
define_functor_symbol(label, ifofu);
|
||||
|
||||
for (unsigned i=0; i<argc; i++) {
|
||||
functor_t obj = new force_functor_s;
|
||||
vvp_ipoint_t iobj = ipoint_index(ifofu, i);
|
||||
functor_define(iobj, obj);
|
||||
|
||||
functor_ref_lookup(&obj->out, strdup(signal.text), signal.idx + i);
|
||||
|
||||
// connect the force expression, one bit.
|
||||
inputs_connect(iobj, 1, &argv[i]);
|
||||
}
|
||||
#else
|
||||
fprintf(stderr, "XXXX compile_force not implemented\n");
|
||||
#endif
|
||||
free(argv);
|
||||
free(signal.text);
|
||||
free(label);
|
||||
}
|
||||
|
||||
void compile_udp_def(int sequ, char *label, char *name,
|
||||
unsigned nin, unsigned init, char **table)
|
||||
{
|
||||
|
|
@ -1566,6 +1524,9 @@ void compile_param_string(char*label, char*name, char*str, char*value)
|
|||
|
||||
/*
|
||||
* $Log: compile.cc,v $
|
||||
* Revision 1.198 2005/04/28 04:59:53 steve
|
||||
* Remove dead functor code.
|
||||
*
|
||||
* Revision 1.197 2005/04/24 20:07:26 steve
|
||||
* Add DFF nodes.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: compile.h,v 1.69 2005/04/24 20:07:26 steve Exp $"
|
||||
#ident "$Id: compile.h,v 1.70 2005/04/28 04:59:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include <stdio.h>
|
||||
|
|
@ -114,12 +114,6 @@ extern void compile_part_select_pv(char*label, char*src,
|
|||
unsigned base, unsigned wid,
|
||||
unsigned vec_wid);
|
||||
|
||||
/*
|
||||
* This is called by the parser to make force functors.
|
||||
*/
|
||||
extern void compile_force(char*label, struct symb_s signal,
|
||||
unsigned argc, struct symb_s*argv);
|
||||
|
||||
/*
|
||||
* This is called by the parser to make the various arithmetic and
|
||||
* comparison functors.
|
||||
|
|
@ -315,6 +309,9 @@ extern void compile_net(char*label, char*name,
|
|||
|
||||
/*
|
||||
* $Log: compile.h,v $
|
||||
* Revision 1.70 2005/04/28 04:59:53 steve
|
||||
* Remove dead functor code.
|
||||
*
|
||||
* Revision 1.69 2005/04/24 20:07:26 steve
|
||||
* Add DFF nodes.
|
||||
*
|
||||
|
|
|
|||
168
vvp/force.cc
168
vvp/force.cc
|
|
@ -1,168 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2000 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu>
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
* General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: force.cc,v 1.11 2004/12/17 04:47:47 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "codes.h"
|
||||
# include "force.h"
|
||||
|
||||
# include <stdio.h>
|
||||
# include <assert.h>
|
||||
|
||||
/*
|
||||
* This functor method turns off the output of the functor by setting
|
||||
* an inhibit flag. While this flag is set, the functor is not
|
||||
* supposed to set its output or propagate values.
|
||||
*/
|
||||
bool functor_s::disable(vvp_ipoint_t ptr)
|
||||
{
|
||||
bool r = inhibit;
|
||||
inhibit = 1;
|
||||
return r;
|
||||
}
|
||||
|
||||
bool functor_s::enable(vvp_ipoint_t ptr)
|
||||
{
|
||||
bool r = inhibit;
|
||||
inhibit = 0;
|
||||
if (r) {
|
||||
if (get_str() != get_ostr()) {
|
||||
propagate(true);
|
||||
} else {
|
||||
assert(get() == get_oval());
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
void force_functor_s::set(vvp_ipoint_t i, bool push,
|
||||
unsigned val, unsigned str)
|
||||
{
|
||||
if (ipoint_port(i) == 0) {
|
||||
oval = val;
|
||||
ostr = str;
|
||||
if (active && out) {
|
||||
functor_t tgt = functor_index(out);
|
||||
if (str != tgt->get_str())
|
||||
tgt->propagate(val, str, push);
|
||||
else
|
||||
assert(val == tgt->get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool release_force(vvp_ipoint_t itgt, functor_t tgt)
|
||||
{
|
||||
// Given the ipointer to the target functor, look for a force
|
||||
// functor that is saving this output value in its input
|
||||
// 3. That is the functor that is forcing me.
|
||||
vvp_ipoint_t *ref = &tgt->out;
|
||||
while (*ref) {
|
||||
functor_t fofu = functor_index(*ref);
|
||||
unsigned pp = ipoint_port(*ref);
|
||||
|
||||
if (pp == 3 && fofu->out == itgt) {
|
||||
force_functor_s *ff = dynamic_cast<force_functor_s *>(fofu);
|
||||
|
||||
if (ff && ff->active) {
|
||||
ff->active = 0;
|
||||
*ref = fofu->port[pp];
|
||||
fofu->port[pp] = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
ref = &fofu->port[pp];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Variable functors receive %set or %assign-ed values at port[0].
|
||||
** Continuous assignments are connected to port[1].
|
||||
**
|
||||
** port[3] points back to the functor that drives the continuous
|
||||
** assignment. This also serves as a flag if assignment is active.
|
||||
**
|
||||
** A constant is assigned if the expr ipoint is < 4, i.e. a port of
|
||||
** the NULL functor. port[3] is set to 3.
|
||||
*/
|
||||
|
||||
void var_functor_s::set(vvp_ipoint_t ptr, bool push, unsigned val, unsigned)
|
||||
{
|
||||
unsigned pp = ipoint_port(ptr);
|
||||
|
||||
if (assigned() && pp==1 || !assigned() && pp==0) {
|
||||
put_oval(val, push);
|
||||
}
|
||||
}
|
||||
|
||||
bool var_functor_s::deassign(vvp_ipoint_t itgt)
|
||||
{
|
||||
if (!assigned())
|
||||
return false;
|
||||
|
||||
vvp_ipoint_t ipt = port[3];
|
||||
|
||||
if (ipt == ipoint_make(0, 3)) {
|
||||
port[3] = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
functor_t fp = functor_index(ipt);
|
||||
vvp_ipoint_t *ref = &fp->out;
|
||||
|
||||
itgt = ipoint_make(itgt, 1);
|
||||
|
||||
while (*ref) {
|
||||
if (*ref == itgt) {
|
||||
*ref = port[1];
|
||||
port[1] = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
functor_t fu = functor_index(*ref);
|
||||
unsigned pp = ipoint_port(*ref);
|
||||
ref = &fu->port[pp];
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* $Log: force.cc,v $
|
||||
* Revision 1.11 2004/12/17 04:47:47 steve
|
||||
* Replace single release with release/net and release/reg.
|
||||
*
|
||||
* Revision 1.10 2004/12/15 17:17:42 steve
|
||||
* Add the force/v instruction.
|
||||
*
|
||||
* Revision 1.9 2004/12/11 02:31:29 steve
|
||||
* Rework of internals to carry vectors through nexus instead
|
||||
* of single bits. Make the ivl, tgt-vvp and vvp initial changes
|
||||
* down this path.
|
||||
*
|
||||
* Revision 1.8 2004/10/04 01:10:59 steve
|
||||
* Clean up spurious trailing white space.
|
||||
*/
|
||||
62
vvp/force.h
62
vvp/force.h
|
|
@ -1,62 +0,0 @@
|
|||
#ifndef __force_H
|
||||
#define __force_H
|
||||
/*
|
||||
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001 Stephan Boettcher <stephan@nevis.columbia.edu>
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
* General Public License as published by the Free Software
|
||||
* Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: force.h,v 1.2 2002/08/12 01:35:08 steve Exp $"
|
||||
#endif
|
||||
|
||||
#include "functor.h"
|
||||
|
||||
/*
|
||||
* Force functors
|
||||
*/
|
||||
|
||||
class force_functor_s : public functor_s
|
||||
{
|
||||
public:
|
||||
force_functor_s() : active(0) {}
|
||||
void set(vvp_ipoint_t i, bool push, unsigned val, unsigned str);
|
||||
unsigned active : 1;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Variable functors
|
||||
*/
|
||||
|
||||
struct var_functor_s: public functor_s {
|
||||
virtual void set(vvp_ipoint_t i, bool push, unsigned val, unsigned str);
|
||||
|
||||
bool assigned() { return !!port[3]; };
|
||||
bool deassign(vvp_ipoint_t itgt);
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* $Log: force.h,v $
|
||||
* Revision 1.2 2002/08/12 01:35:08 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
* Revision 1.1 2001/11/01 03:00:19 steve
|
||||
* Add force/cassign/release/deassign support. (Stephan Boettcher)
|
||||
*
|
||||
*/
|
||||
#endif
|
||||
183
vvp/functor.cc
183
vvp/functor.cc
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: functor.cc,v 1.47 2005/04/03 06:13:34 steve Exp $"
|
||||
#ident "$Id: functor.cc,v 1.48 2005/04/28 04:59:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "functor.h"
|
||||
|
|
@ -31,191 +31,16 @@
|
|||
|
||||
# include <stdio.h>
|
||||
|
||||
/*
|
||||
* Functors are created as the source design is read in. Each is
|
||||
* assigned an ipoint_t address starting from 1. The design is
|
||||
* expected to have a create many functors, so it makes sense to
|
||||
* allocate the functors in chunks. This structure describes a chunk
|
||||
* of functors.
|
||||
*
|
||||
* The 32bit vvp_ipoint_t allows for 2**30 functors in the
|
||||
* design. (2 bits are used to select the input of the functor.) The
|
||||
* functor address is, for the purpose of lookup up addresses, divided
|
||||
* into three parts, the index within a chunk, the index of the chunk
|
||||
* within an index1 table, and the index of the index1 within the root
|
||||
* table. There is a single root table. The index1 tables and chunk
|
||||
* tables are allocated as needed.
|
||||
*/
|
||||
|
||||
functor_t **functor_list = 0x0;
|
||||
static unsigned functor_count = 0;
|
||||
static unsigned functor_chunk_count = 0;
|
||||
|
||||
/*
|
||||
* This function initializes the functor address space by creating the
|
||||
* zero functor. This means creating a functor_index1 and a
|
||||
* functor_index0, and initializing the count to 1.
|
||||
*/
|
||||
void functor_init(void)
|
||||
{
|
||||
// allocate the ZERO functor.
|
||||
functor_allocate(1);
|
||||
}
|
||||
|
||||
unsigned functor_limit()
|
||||
{
|
||||
return functor_count;
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate normally is just a matter of incrementing the functor_count
|
||||
* and returning a pointer to the next unallocated functor. However,
|
||||
* if we overrun an allocated chunk, we need to allocate the needed
|
||||
* bits first.
|
||||
*/
|
||||
vvp_ipoint_t functor_allocate(unsigned wid)
|
||||
{
|
||||
vvp_ipoint_t idx = functor_count*4;
|
||||
functor_count += wid;
|
||||
count_functors += wid;
|
||||
|
||||
if (functor_count > functor_chunk_count*functor_chunk_size) {
|
||||
|
||||
// enlarge the list of chunks
|
||||
unsigned fa = (functor_count + functor_chunk_size - 1)
|
||||
/ functor_chunk_size;
|
||||
|
||||
functor_list = (functor_t **)
|
||||
realloc(functor_list, fa*sizeof(functor_t*));
|
||||
assert(functor_list);
|
||||
|
||||
// allocate the chunks of functor pointers.
|
||||
while (fa > functor_chunk_count) {
|
||||
|
||||
functor_list[functor_chunk_count] = (functor_t *)
|
||||
malloc(functor_chunk_size * sizeof(functor_t));
|
||||
assert(functor_list[functor_chunk_count]);
|
||||
|
||||
memset(functor_list[functor_chunk_count], 0,
|
||||
functor_chunk_size * sizeof(functor_t));
|
||||
|
||||
functor_chunk_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
void functor_define(vvp_ipoint_t point, functor_t obj)
|
||||
{
|
||||
unsigned index1 = point/4/functor_chunk_size;
|
||||
unsigned index2 = (point/4) % functor_chunk_size;
|
||||
functor_list[index1][index2] = obj;
|
||||
}
|
||||
|
||||
#if 0
|
||||
functor_s::functor_s()
|
||||
{
|
||||
delay = 0;
|
||||
out = 0;
|
||||
port[0] = 0;
|
||||
port[1] = 0;
|
||||
port[2] = 0;
|
||||
port[3] = 0;
|
||||
ival = 0xaa;
|
||||
cval = 2;
|
||||
oval = 2;
|
||||
odrive0 = 6;
|
||||
odrive1 = 6;
|
||||
ostr = StX;
|
||||
cstr = StX;
|
||||
inhibit = 0;
|
||||
}
|
||||
#endif
|
||||
functor_s::~functor_s()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* This method sets the saved output value, bits and strength, then
|
||||
* propagates that value to the connected inputs.
|
||||
*/
|
||||
void functor_s::propagate(unsigned val, unsigned str, bool push)
|
||||
{
|
||||
cval = val;
|
||||
cstr = str;
|
||||
vvp_ipoint_t idx = out;
|
||||
while (idx) {
|
||||
functor_t idxp = functor_index(idx);
|
||||
idxp->set(idx, push, val, str);
|
||||
idx = idxp->port[ipoint_port(idx)];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void functor_s::put_ostr(unsigned val, unsigned str,
|
||||
bool push, bool nba_flag)
|
||||
{
|
||||
#if 0
|
||||
if (str != get_ostr() || val != get_oval()) {
|
||||
|
||||
unsigned char ooval = oval;
|
||||
ostr = str;
|
||||
oval = val;
|
||||
|
||||
/* If output is inhibited (by a .force functor) then
|
||||
this is as far as we go. */
|
||||
if (inhibit)
|
||||
return;
|
||||
|
||||
unsigned del;
|
||||
if (delay)
|
||||
del = vvp_delay_get(delay, ooval, val);
|
||||
else
|
||||
del = 0;
|
||||
|
||||
if (push && del == 0) {
|
||||
propagate(push);
|
||||
}
|
||||
else
|
||||
schedule(del, nba_flag);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: functor.cc,v $
|
||||
* Revision 1.48 2005/04/28 04:59:53 steve
|
||||
* Remove dead functor code.
|
||||
*
|
||||
* Revision 1.47 2005/04/03 06:13:34 steve
|
||||
* Remove dead fvectors class.
|
||||
*
|
||||
* Revision 1.46 2005/04/03 05:45:51 steve
|
||||
* Rework the vvp_delay_t class.
|
||||
*
|
||||
* Revision 1.45 2005/03/06 17:25:03 steve
|
||||
* Remove dead code from scheduler.
|
||||
*
|
||||
* Revision 1.44 2004/10/04 01:10:59 steve
|
||||
* Clean up spurious trailing white space.
|
||||
*
|
||||
* Revision 1.43 2003/09/09 00:56:45 steve
|
||||
* Reimpelement scheduler to divide nonblocking assign queue out.
|
||||
*
|
||||
* Revision 1.42 2003/03/13 04:36:57 steve
|
||||
* Remove the obsolete functor delete functions.
|
||||
*
|
||||
* Revision 1.41 2002/08/12 01:35:08 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
* Revision 1.40 2002/08/07 00:54:20 steve
|
||||
* Documentation, and excessive inlines.
|
||||
*
|
||||
* Revision 1.39 2002/07/05 02:50:58 steve
|
||||
* Remove the vpi object symbol table after compile.
|
||||
*
|
||||
* Revision 1.38 2002/01/06 17:50:50 steve
|
||||
* Support scope for functors. (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.37 2001/12/18 05:32:11 steve
|
||||
* Improved functor debug dumps.
|
||||
*/
|
||||
|
||||
|
|
|
|||
186
vvp/functor.h
186
vvp/functor.h
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: functor.h,v 1.56 2005/04/03 06:16:54 steve Exp $"
|
||||
#ident "$Id: functor.h,v 1.57 2005/04/28 04:59:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
/* NOTE: THIS FILE IS BEOING PHASED OUT. IT'S FUNCTIONALITY IS OBSOLETE. */
|
||||
|
|
@ -98,52 +98,6 @@ enum strength_e {
|
|||
};
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the functors address space. This function must be called
|
||||
* exactly once before any of the other functor functions may be
|
||||
* called.
|
||||
*/
|
||||
extern void functor_init(void);
|
||||
|
||||
/*
|
||||
* This function allocates a functor and returns the vvp_ipoint_t
|
||||
* address for it. Every call to functor_allocate is guaranteed to
|
||||
* return a different vvp_ipoint_t address. The ipoint port bits are 0.
|
||||
*
|
||||
* If the wid is >1, a bunch of contiguous functors is created, and
|
||||
* the return value is the address of the first in the vector.
|
||||
*/
|
||||
extern vvp_ipoint_t functor_allocate(unsigned wid);
|
||||
|
||||
/*
|
||||
** Return the number of allocated functors
|
||||
*/
|
||||
extern unsigned functor_limit();
|
||||
|
||||
/*
|
||||
* Given an ipoint_t pointer, return a C pointer to the functor. This
|
||||
* is like a pointer dereference. The point parameter must have been
|
||||
* returned from a previous call to functor_allocate.
|
||||
*/
|
||||
|
||||
extern functor_t **functor_list;
|
||||
static const unsigned functor_chunk_size = 0x400;
|
||||
|
||||
inline static functor_t functor_index(vvp_ipoint_t point)
|
||||
{
|
||||
unsigned index1 = point/4/functor_chunk_size;
|
||||
unsigned index2 = (point/4) % functor_chunk_size;
|
||||
|
||||
return functor_list[index1][index2];
|
||||
}
|
||||
|
||||
/*
|
||||
* This function defines the functor object. After allocation an ipoint,
|
||||
* you must call this before functor_index() is called on it.
|
||||
*/
|
||||
extern void functor_define(vvp_ipoint_t point, functor_t obj);
|
||||
|
||||
|
||||
/*
|
||||
** The functor object
|
||||
*/
|
||||
|
|
@ -204,145 +158,13 @@ struct functor_s {
|
|||
void propagate(unsigned val, unsigned str, bool push);
|
||||
};
|
||||
|
||||
/*
|
||||
* Set the ival for input port ptr to value val.
|
||||
*/
|
||||
|
||||
inline void functor_s::put(vvp_ipoint_t ptr, unsigned val)
|
||||
{
|
||||
static const unsigned char ival_mask[4] = { 0xfc, 0xf3, 0xcf, 0x3f };
|
||||
unsigned pp = ipoint_port(ptr);
|
||||
unsigned char imask = ival_mask[pp];
|
||||
ival = (ival & imask) | ((val & 3) << (2*pp));
|
||||
}
|
||||
|
||||
inline void functor_s::propagate(bool push)
|
||||
{
|
||||
propagate(get_oval(), get_ostr(), push);
|
||||
}
|
||||
|
||||
inline void functor_s::put_oval(unsigned val, bool push, bool nba_flag)
|
||||
{
|
||||
unsigned char str;
|
||||
switch (val) {
|
||||
case 0:
|
||||
str = 0x00 | (odrive0<<0) | (odrive0<<4);
|
||||
break;
|
||||
case 1:
|
||||
str = 0x88 | (odrive1<<0) | (odrive1<<4);
|
||||
break;
|
||||
case 2:
|
||||
str = 0x80 | (odrive0<<0) | (odrive1<<4);
|
||||
break;
|
||||
default:
|
||||
str = 0x00;
|
||||
break;
|
||||
}
|
||||
|
||||
put_ostr(val, str, push, nba_flag);
|
||||
}
|
||||
|
||||
/*
|
||||
* functor_set sets the addressed input to the specified value, and
|
||||
* calculates a new output value. If there is any propagation to do,
|
||||
* propagation events are created. Propagation calls further
|
||||
* functor_set methods for the functors connected to the output.
|
||||
*
|
||||
* The val contains 2 bits two represent the 4-value bit. The str
|
||||
* version is also passed, and typically just stored in the
|
||||
* functor.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Set the addressed bit of the functor, and recalculate the
|
||||
* output. If the output changes any, then generate the necessary
|
||||
* propagation events to pass the output on.
|
||||
*/
|
||||
inline static
|
||||
void functor_set(vvp_ipoint_t ptr, unsigned val, unsigned str, bool push)
|
||||
{
|
||||
functor_t fp = functor_index(ptr);
|
||||
fp->set(ptr, push, val, str);
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the value of the functor. In fact, only the *value* is read --
|
||||
* the strength of that value is stripped off.
|
||||
*/
|
||||
inline static
|
||||
unsigned functor_get(vvp_ipoint_t ptr)
|
||||
{
|
||||
functor_t fp = functor_index(ptr);
|
||||
return fp->get();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* $Log: functor.h,v $
|
||||
* Revision 1.57 2005/04/28 04:59:53 steve
|
||||
* Remove dead functor code.
|
||||
*
|
||||
* Revision 1.56 2005/04/03 06:16:54 steve
|
||||
* Remove dead fvectors class.
|
||||
*
|
||||
* Revision 1.55 2005/04/03 06:13:34 steve
|
||||
* Remove dead fvectors class.
|
||||
*
|
||||
* Revision 1.54 2005/03/06 17:25:03 steve
|
||||
* Remove dead code from scheduler.
|
||||
*
|
||||
* Revision 1.53 2004/12/11 02:31:29 steve
|
||||
* Rework of internals to carry vectors through nexus instead
|
||||
* of single bits. Make the ivl, tgt-vvp and vvp initial changes
|
||||
* down this path.
|
||||
*
|
||||
* Revision 1.52 2004/10/04 01:10:59 steve
|
||||
* Clean up spurious trailing white space.
|
||||
*
|
||||
* Revision 1.51 2003/09/09 00:56:45 steve
|
||||
* Reimpelement scheduler to divide nonblocking assign queue out.
|
||||
*
|
||||
* Revision 1.50 2003/03/13 04:36:57 steve
|
||||
* Remove the obsolete functor delete functions.
|
||||
*
|
||||
* Revision 1.49 2003/02/09 23:33:26 steve
|
||||
* Spelling fixes.
|
||||
*
|
||||
* Revision 1.48 2002/08/12 01:35:08 steve
|
||||
* conditional ident string using autoconfig.
|
||||
*
|
||||
* Revision 1.47 2002/08/07 00:54:20 steve
|
||||
* Documentation, and excessive inlines.
|
||||
*
|
||||
* Revision 1.46 2002/05/19 05:18:16 steve
|
||||
* Add callbacks for vpiNamedEvent objects.
|
||||
*
|
||||
* Revision 1.45 2002/03/17 03:23:10 steve
|
||||
* Force the push flags to be explicit.
|
||||
*
|
||||
* Revision 1.44 2002/01/06 17:50:50 steve
|
||||
* Support scope for functors. (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.43 2002/01/06 03:15:13 steve
|
||||
* Support weak functor inputs.
|
||||
*
|
||||
* Revision 1.42 2001/12/18 05:32:11 steve
|
||||
* Improved functor debug dumps.
|
||||
*
|
||||
* Revision 1.41 2001/12/14 01:59:28 steve
|
||||
* Better variable names for functor chunks.
|
||||
*
|
||||
* Revision 1.40 2001/12/06 03:31:24 steve
|
||||
* Support functor delays for gates and UDP devices.
|
||||
* (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.39 2001/11/10 18:07:12 steve
|
||||
* Runtime support for functor delays. (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.38 2001/11/07 03:34:42 steve
|
||||
* Use functor pointers where vvp_ipoint_t is unneeded.
|
||||
*
|
||||
* Revision 1.37 2001/11/06 03:07:22 steve
|
||||
* Code rearrange. (Stephan Boettcher)
|
||||
*
|
||||
* Revision 1.36 2001/11/01 03:00:19 steve
|
||||
* Add force/cassign/release/deassign support. (Stephan Boettcher)
|
||||
*/
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
%{
|
||||
/*
|
||||
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
||||
* Copyright (c) 2001-2005 Stephen Williams (steve@icarus.com)
|
||||
*
|
||||
* This source code is free software; you can redistribute it
|
||||
* and/or modify it in source code form under the terms of the GNU
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: lexor.lex,v 1.51 2005/04/24 20:07:26 steve Exp $"
|
||||
#ident "$Id: lexor.lex,v 1.52 2005/04/28 04:59:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "parse_misc.h"
|
||||
|
|
@ -131,7 +131,6 @@
|
|||
".mem" { return K_MEM; }
|
||||
".mem/p"(ort)? { return K_MEM_P; }
|
||||
".mem/i"(nit)? { return K_MEM_I; }
|
||||
".force" { return K_FORCE; }
|
||||
|
||||
/* instructions start with a % character. The compiler decides what
|
||||
kind of instruction this really is. The few exceptions (that have
|
||||
|
|
@ -195,6 +194,9 @@ int yywrap()
|
|||
|
||||
/*
|
||||
* $Log: lexor.lex,v $
|
||||
* Revision 1.52 2005/04/28 04:59:53 steve
|
||||
* Remove dead functor code.
|
||||
*
|
||||
* Revision 1.51 2005/04/24 20:07:26 steve
|
||||
* Add DFF nodes.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: npmos.cc,v 1.9 2004/10/04 01:10:59 steve Exp $"
|
||||
#ident "$Id: npmos.cc,v 1.10 2005/04/28 04:59:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "npmos.h"
|
||||
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
void vvp_pmos_s::set(vvp_ipoint_t ptr, bool push, unsigned v, unsigned s)
|
||||
{
|
||||
#if 0
|
||||
put(ptr, v);
|
||||
|
||||
unsigned pp = ipoint_port(ptr);
|
||||
|
|
@ -86,10 +87,16 @@ void vvp_pmos_s::set(vvp_ipoint_t ptr, bool push, unsigned v, unsigned s)
|
|||
}
|
||||
|
||||
put_ostr(val, str, push);
|
||||
#else
|
||||
assert(0); // not implemented.
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* $Log: npmos.cc,v $
|
||||
* Revision 1.10 2005/04/28 04:59:53 steve
|
||||
* Remove dead functor code.
|
||||
*
|
||||
* Revision 1.9 2004/10/04 01:10:59 steve
|
||||
* Clean up spurious trailing white space.
|
||||
*
|
||||
|
|
|
|||
15
vvp/parse.y
15
vvp/parse.y
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: parse.y,v 1.72 2005/04/24 20:07:26 steve Exp $"
|
||||
#ident "$Id: parse.y,v 1.73 2005/04/28 04:59:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "parse_misc.h"
|
||||
|
|
@ -68,7 +68,7 @@ extern FILE*yyin;
|
|||
%token K_RESOLV K_SCOPE K_SHIFTL K_SHIFTR K_THREAD K_TIMESCALE K_UFUNC
|
||||
%token K_UDP K_UDP_C K_UDP_S
|
||||
%token K_MEM K_MEM_P K_MEM_I
|
||||
%token K_FORCE K_WORD
|
||||
%token K_WORD
|
||||
%token K_VAR K_VAR_S K_VAR_I K_vpi_call K_vpi_func K_vpi_func_r
|
||||
%token K_disable K_fork
|
||||
%token K_vpi_module K_vpi_time_precision
|
||||
|
|
@ -198,14 +198,6 @@ statement
|
|||
symbols ';'
|
||||
{ compile_concat($1, $4, $5, $6, $7, $10.cnt, $10.vect); }
|
||||
|
||||
/* Force statements are very much like functors. They are
|
||||
compiled to functors of a different mode. */
|
||||
|
||||
| T_LABEL K_FORCE symbol ',' symbols ';'
|
||||
{ struct symbv_s obj = $5;
|
||||
compile_force($1, $3, obj.cnt, obj.vect);
|
||||
}
|
||||
|
||||
/* Arithmetic statements generate functor arrays of a given width
|
||||
that take like size input vectors. */
|
||||
|
||||
|
|
@ -686,6 +678,9 @@ int compile_design(const char*path)
|
|||
|
||||
/*
|
||||
* $Log: parse.y,v $
|
||||
* Revision 1.73 2005/04/28 04:59:53 steve
|
||||
* Remove dead functor code.
|
||||
*
|
||||
* Revision 1.72 2005/04/24 20:07:26 steve
|
||||
* Add DFF nodes.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: vpi_priv.h,v 1.61 2005/03/03 04:33:10 steve Exp $"
|
||||
#ident "$Id: vpi_priv.h,v 1.62 2005/04/28 04:59:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "vpi_user.h"
|
||||
|
|
@ -370,13 +370,14 @@ extern vvp_time64_t vpip_timestruct_to_time(const struct t_vpi_time*ts);
|
|||
extern const char* vpip_string(const char*str);
|
||||
extern const char* vpip_name_string(const char*str);
|
||||
|
||||
#if 0
|
||||
/*
|
||||
** Functions defined in vpi_scope.cc, to keep track of functor scope.
|
||||
*/
|
||||
|
||||
extern vpiHandle ipoint_get_scope(vvp_ipoint_t ipt);
|
||||
extern void functor_set_scope(vpiHandle scope);
|
||||
|
||||
#endif
|
||||
/*
|
||||
* This function is used to make decimal string versions of various
|
||||
* vectors. The input format is an array of bit values (0, 1, 2, 3)
|
||||
|
|
@ -417,6 +418,9 @@ extern char *need_result_buf(unsigned cnt, vpi_rbuf_t type);
|
|||
|
||||
/*
|
||||
* $Log: vpi_priv.h,v $
|
||||
* Revision 1.62 2005/04/28 04:59:53 steve
|
||||
* Remove dead functor code.
|
||||
*
|
||||
* Revision 1.61 2005/03/03 04:33:10 steve
|
||||
* Rearrange how memories are supported as vvp_vector4 arrays.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ifdef HAVE_CVS_IDENT
|
||||
#ident "$Id: vpi_scope.cc,v 1.32 2004/10/04 01:10:59 steve Exp $"
|
||||
#ident "$Id: vpi_scope.cc,v 1.33 2005/04/28 04:59:53 steve Exp $"
|
||||
#endif
|
||||
|
||||
# include "compile.h"
|
||||
|
|
@ -224,16 +224,18 @@ static vpiHandle module_iter(int code, vpiHandle obj)
|
|||
** the same module. But those should have the same delays anyway.
|
||||
**
|
||||
*/
|
||||
|
||||
#if 0
|
||||
struct functor_scope_s {
|
||||
vpiHandle scope;
|
||||
unsigned start;
|
||||
};
|
||||
|
||||
#endif
|
||||
#if 0
|
||||
static struct functor_scope_s * functor_scopes = 0;
|
||||
static unsigned n_functor_scopes = 0;
|
||||
static unsigned a_functor_scopes = 0;
|
||||
|
||||
#endif
|
||||
#if 0
|
||||
void functor_set_scope(vpiHandle scope)
|
||||
{
|
||||
unsigned nfun = functor_limit();
|
||||
|
|
@ -264,7 +266,8 @@ void functor_set_scope(vpiHandle scope)
|
|||
last->start = nfun;
|
||||
last->scope = scope;
|
||||
}
|
||||
|
||||
#endif
|
||||
#if 0
|
||||
/*
|
||||
** Look up the scope of a functor.
|
||||
**
|
||||
|
|
@ -294,6 +297,7 @@ vpiHandle ipoint_get_scope(vvp_ipoint_t ipt)
|
|||
functor_scope_s *cur = &functor_scopes[first];
|
||||
return cur->scope;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const struct __vpirt vpip_scope_module_rt = {
|
||||
vpiModule,
|
||||
|
|
@ -439,15 +443,18 @@ compile_scope_decl(char*label, char*type, char*name, char*tname, char*parent)
|
|||
/* Root scopes inherit time_units from system precision. */
|
||||
scope->time_units = vpip_get_time_precision();
|
||||
}
|
||||
|
||||
#if 0
|
||||
functor_set_scope(¤t_scope->base);
|
||||
#endif
|
||||
}
|
||||
|
||||
void compile_scope_recall(char*symbol)
|
||||
{
|
||||
compile_vpi_lookup((vpiHandle*)¤t_scope, symbol);
|
||||
assert(current_scope);
|
||||
#if 0
|
||||
functor_set_scope(¤t_scope->base);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -473,6 +480,9 @@ void vpip_attach_to_current_scope(vpiHandle obj)
|
|||
|
||||
/*
|
||||
* $Log: vpi_scope.cc,v $
|
||||
* Revision 1.33 2005/04/28 04:59:53 steve
|
||||
* Remove dead functor code.
|
||||
*
|
||||
* Revision 1.32 2004/10/04 01:10:59 steve
|
||||
* Clean up spurious trailing white space.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
#ident "$Id: vvp_net.cc,v 1.25 2005/04/25 04:42:17 steve Exp $"
|
||||
#ident "$Id: vvp_net.cc,v 1.26 2005/04/28 04:59:53 steve Exp $"
|
||||
|
||||
# include "config.h"
|
||||
# include "vvp_net.h"
|
||||
|
|
@ -710,7 +710,7 @@ bool vvp_fun_signal::type_is_vector8_() const
|
|||
* herein is to keep a "needs_init_" flag that is turned false after
|
||||
* the first propagation, and forces the first propagation to happen
|
||||
* even if it matches the initial value.
|
||||
*/ */
|
||||
*/
|
||||
void vvp_fun_signal::recv_vec4(vvp_net_ptr_t ptr, vvp_vector4_t bit)
|
||||
{
|
||||
switch (ptr.port()) {
|
||||
|
|
@ -1338,6 +1338,9 @@ vvp_bit4_t compare_gtge_signed(const vvp_vector4_t&a,
|
|||
|
||||
/*
|
||||
* $Log: vvp_net.cc,v $
|
||||
* Revision 1.26 2005/04/28 04:59:53 steve
|
||||
* Remove dead functor code.
|
||||
*
|
||||
* Revision 1.25 2005/04/25 04:42:17 steve
|
||||
* vvp_fun_signal eliminates duplicate propagations.
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue