2001-03-21 02:49:43 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2001 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
|
|
|
|
|
* 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
|
|
|
|
|
*/
|
|
|
|
|
#if !defined(WINNT)
|
2001-10-18 19:30:25 +02:00
|
|
|
#ident "$Id: vvp_scope.c,v 1.51 2001/10/18 17:30:25 steve Exp $"
|
2001-03-21 02:49:43 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
# include "vvp_priv.h"
|
|
|
|
|
# include <assert.h>
|
2001-09-15 20:27:04 +02:00
|
|
|
#ifdef HAVE_MALLOC_H
|
2001-04-24 04:23:58 +02:00
|
|
|
# include <malloc.h>
|
2001-09-15 20:27:04 +02:00
|
|
|
#endif
|
|
|
|
|
# include <stdlib.h>
|
2001-05-06 02:01:02 +02:00
|
|
|
# include <string.h>
|
2001-03-21 02:49:43 +01:00
|
|
|
|
2001-06-18 05:10:34 +02:00
|
|
|
/*
|
|
|
|
|
* Escape non-symbol chararacters in ids, and quotes in strings.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
inline static char hex_digit(unsigned i)
|
|
|
|
|
{
|
|
|
|
|
i &= 0xf;
|
|
|
|
|
return i>=10 ? i-10+'A' : i+'0';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *vvp_mangle_id(const char *id)
|
|
|
|
|
{
|
|
|
|
|
static char *out = 0x0;
|
|
|
|
|
static size_t out_len;
|
|
|
|
|
|
|
|
|
|
int nesc = 0;
|
|
|
|
|
int iout = 0;
|
|
|
|
|
const char *inp = id;
|
|
|
|
|
|
|
|
|
|
const char nosym[] = "!\"#%&'()*+,-/:;<=>?@[\\]^`{|}~";
|
|
|
|
|
|
|
|
|
|
char *se = strpbrk(inp, nosym);
|
|
|
|
|
if (!se)
|
|
|
|
|
return id;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
int n = se - inp;
|
|
|
|
|
int nlen = strlen(id) + 4*(++nesc) + 1;
|
|
|
|
|
if (out_len < nlen) {
|
|
|
|
|
out = (char *) realloc(out, nlen);
|
|
|
|
|
assert(out);
|
|
|
|
|
out_len = nlen;
|
|
|
|
|
}
|
|
|
|
|
if (n) {
|
|
|
|
|
strncpy(out+iout, inp, n);
|
|
|
|
|
iout += n;
|
|
|
|
|
}
|
|
|
|
|
inp += n+1;
|
|
|
|
|
out[iout++] = '\\';
|
|
|
|
|
switch (*se) {
|
|
|
|
|
case '\\':
|
|
|
|
|
case '/':
|
|
|
|
|
case '<':
|
|
|
|
|
case '>':
|
|
|
|
|
out[iout++] = *se;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
out[iout++] = 'x';
|
|
|
|
|
out[iout++] = hex_digit(*se >> 4);
|
|
|
|
|
out[iout++] = hex_digit(*se);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
se = strpbrk(inp, nosym);
|
|
|
|
|
} while (se);
|
|
|
|
|
|
|
|
|
|
strcpy(out+iout, inp);
|
|
|
|
|
return out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *vvp_mangle_name(const char *id)
|
|
|
|
|
{
|
|
|
|
|
static char *out = 0x0;
|
|
|
|
|
static size_t out_len;
|
|
|
|
|
|
|
|
|
|
int nesc = 0;
|
|
|
|
|
int iout = 0;
|
|
|
|
|
const char *inp = id;
|
|
|
|
|
|
|
|
|
|
const char nosym[] = "\"\\";
|
|
|
|
|
|
|
|
|
|
char *se = strpbrk(inp, nosym);
|
|
|
|
|
if (!se)
|
|
|
|
|
return id;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
int n = se - inp;
|
|
|
|
|
int nlen = strlen(id) + 2*(++nesc) + 1;
|
|
|
|
|
if (out_len < nlen) {
|
|
|
|
|
out = (char *) realloc(out, nlen);
|
|
|
|
|
assert(out);
|
|
|
|
|
out_len = nlen;
|
|
|
|
|
}
|
|
|
|
|
if (n) {
|
|
|
|
|
strncpy(out+iout, inp, n);
|
|
|
|
|
iout += n;
|
|
|
|
|
}
|
|
|
|
|
inp += n+1;
|
|
|
|
|
out[iout++] = '\\';
|
|
|
|
|
out[iout++] = *se;
|
|
|
|
|
|
|
|
|
|
se = strpbrk(inp, nosym);
|
|
|
|
|
} while (se);
|
|
|
|
|
|
|
|
|
|
strcpy(out+iout, inp);
|
|
|
|
|
return out;
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-21 02:49:43 +01:00
|
|
|
/*
|
2001-03-25 05:25:43 +02:00
|
|
|
* The draw_scope function draws the major functional items within a
|
|
|
|
|
* scope. This includes the scopes themselves, of course. All the
|
|
|
|
|
* other functions in this file are in support of that task.
|
2001-03-21 02:49:43 +01:00
|
|
|
*/
|
2001-03-25 05:25:43 +02:00
|
|
|
|
2001-05-12 05:31:01 +02:00
|
|
|
static const char* draw_net_input(ivl_nexus_t nex);
|
|
|
|
|
|
2001-05-06 02:01:02 +02:00
|
|
|
/*
|
|
|
|
|
* NEXUS
|
|
|
|
|
* ivl builds up the netlist into objects connected together by
|
|
|
|
|
* ivl_nexus_t objects. The nexus receives all the drivers of the
|
|
|
|
|
* point in the net and resolves the value. The result is then sent to
|
|
|
|
|
* all the nets that are connected to the nexus. The nets, then, are
|
|
|
|
|
* read to get the value of the nexus.
|
|
|
|
|
*
|
|
|
|
|
* NETS
|
|
|
|
|
* Nets are interesting and special, because a nexus may be connected
|
|
|
|
|
* to several of them at once. This can happen, for example, as an
|
|
|
|
|
* artifact of module port connects, where the inside and the outside
|
|
|
|
|
* of the module are connected through an in-out port. (In fact, ivl
|
|
|
|
|
* will simply connect signals that are bound through a port, because
|
|
|
|
|
* the input/output/inout properties are enforced as compile time.)
|
|
|
|
|
*
|
|
|
|
|
* This case is handled by choosing one to receive the value of the
|
|
|
|
|
* nexus. This one then feeds to another net at the nexus, and so
|
|
|
|
|
* on. The last net is selected as the output of the nexus.
|
|
|
|
|
*/
|
2001-03-25 05:25:43 +02:00
|
|
|
/*
|
|
|
|
|
* This function takes a nexus and looks for an input functor. It then
|
2001-05-06 02:01:02 +02:00
|
|
|
* draws to the output a string that represents that functor. What we
|
|
|
|
|
* are trying to do here is find the input to the net that is attached
|
|
|
|
|
* to this nexus.
|
2001-03-25 05:25:43 +02:00
|
|
|
*/
|
2001-05-12 05:31:01 +02:00
|
|
|
|
|
|
|
|
static const char* draw_net_input_drive(ivl_nexus_t nex, ivl_nexus_ptr_t nptr)
|
2001-03-25 05:25:43 +02:00
|
|
|
{
|
2001-05-12 05:31:01 +02:00
|
|
|
static char result[2048];
|
|
|
|
|
unsigned idx;
|
|
|
|
|
unsigned nptr_pin = ivl_nexus_ptr_pin(nptr);
|
2001-04-30 01:16:31 +02:00
|
|
|
ivl_net_const_t cptr;
|
2001-03-25 05:25:43 +02:00
|
|
|
ivl_net_logic_t lptr;
|
|
|
|
|
ivl_signal_t sptr;
|
2001-04-26 07:12:02 +02:00
|
|
|
ivl_lpm_t lpm;
|
2001-03-25 05:25:43 +02:00
|
|
|
|
2001-05-12 05:31:01 +02:00
|
|
|
lptr = ivl_nexus_ptr_log(nptr);
|
|
|
|
|
if (lptr && (ivl_logic_type(lptr) == IVL_LO_BUFZ) &&
|
|
|
|
|
(nptr_pin == 0)) {
|
|
|
|
|
return draw_net_input(ivl_logic_pin(lptr, 1));
|
|
|
|
|
}
|
2001-04-30 01:16:31 +02:00
|
|
|
|
2001-05-12 05:31:01 +02:00
|
|
|
if (lptr && (ivl_logic_type(lptr) == IVL_LO_PULLDOWN)) {
|
2001-05-12 18:34:47 +02:00
|
|
|
return "C<pu0>";
|
2001-05-12 05:31:01 +02:00
|
|
|
}
|
2001-03-25 05:25:43 +02:00
|
|
|
|
2001-05-12 05:31:01 +02:00
|
|
|
if (lptr && (ivl_logic_type(lptr) == IVL_LO_PULLUP)) {
|
2001-05-12 18:34:47 +02:00
|
|
|
return "C<pu1>";
|
2001-05-12 05:31:01 +02:00
|
|
|
}
|
2001-04-30 01:16:31 +02:00
|
|
|
|
2001-05-12 05:31:01 +02:00
|
|
|
if (lptr && (nptr_pin == 0)) {
|
2001-06-18 05:10:34 +02:00
|
|
|
sprintf(result, "L_%s", vvp_mangle_id(ivl_logic_name(lptr)));
|
2001-05-12 05:31:01 +02:00
|
|
|
return result;
|
|
|
|
|
}
|
2001-04-30 01:16:31 +02:00
|
|
|
|
2001-05-12 05:31:01 +02:00
|
|
|
sptr = ivl_nexus_ptr_sig(nptr);
|
|
|
|
|
if (sptr && (ivl_signal_type(sptr) == IVL_SIT_REG)) {
|
2001-06-18 05:10:34 +02:00
|
|
|
sprintf(result, "V_%s[%u]", vvp_mangle_id(ivl_signal_name(sptr)),
|
2001-05-12 05:31:01 +02:00
|
|
|
nptr_pin);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2001-04-30 01:16:31 +02:00
|
|
|
|
2001-07-22 23:31:14 +02:00
|
|
|
if (sptr && (ivl_signal_type(sptr) == IVL_SIT_SUPPLY1)) {
|
2001-07-28 05:18:50 +02:00
|
|
|
return "C<su1>";
|
2001-07-22 23:31:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sptr && (ivl_signal_type(sptr) == IVL_SIT_SUPPLY0)) {
|
2001-07-28 05:18:50 +02:00
|
|
|
return "C<su0>";
|
2001-07-22 23:31:14 +02:00
|
|
|
}
|
|
|
|
|
|
2001-05-12 05:31:01 +02:00
|
|
|
cptr = ivl_nexus_ptr_con(nptr);
|
|
|
|
|
if (cptr) {
|
|
|
|
|
const char*bits = ivl_const_bits(cptr);
|
|
|
|
|
sprintf(result, "C<%c>", bits[nptr_pin]);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2001-03-25 05:25:43 +02:00
|
|
|
|
2001-05-12 05:31:01 +02:00
|
|
|
lpm = ivl_nexus_ptr_lpm(nptr);
|
|
|
|
|
if (lpm) switch (ivl_lpm_type(lpm)) {
|
2001-04-30 01:16:31 +02:00
|
|
|
|
2001-05-12 05:31:01 +02:00
|
|
|
case IVL_LPM_MUX:
|
|
|
|
|
for (idx = 0 ; idx < ivl_lpm_width(lpm) ; idx += 1)
|
|
|
|
|
if (ivl_lpm_q(lpm, idx) == nex) {
|
|
|
|
|
sprintf(result, "L_%s/%u",
|
2001-06-18 05:10:34 +02:00
|
|
|
vvp_mangle_id(ivl_lpm_name(lpm)), idx);
|
2001-05-12 05:31:01 +02:00
|
|
|
return result;
|
|
|
|
|
}
|
2001-06-15 06:14:18 +02:00
|
|
|
break;
|
2001-03-25 05:25:43 +02:00
|
|
|
|
2001-06-16 04:41:41 +02:00
|
|
|
case IVL_LPM_RAM:
|
2001-06-07 04:12:43 +02:00
|
|
|
case IVL_LPM_ADD:
|
2001-07-06 06:48:04 +02:00
|
|
|
case IVL_LPM_SHIFTL:
|
|
|
|
|
case IVL_LPM_SHIFTR:
|
2001-06-07 05:09:37 +02:00
|
|
|
case IVL_LPM_SUB:
|
2001-06-17 01:45:05 +02:00
|
|
|
case IVL_LPM_MULT:
|
2001-10-16 04:19:26 +02:00
|
|
|
case IVL_LPM_DIVIDE:
|
2001-06-07 04:12:43 +02:00
|
|
|
for (idx = 0 ; idx < ivl_lpm_width(lpm) ; idx += 1)
|
|
|
|
|
if (ivl_lpm_q(lpm, idx) == nex) {
|
|
|
|
|
sprintf(result, "L_%s[%u]",
|
2001-06-18 05:10:34 +02:00
|
|
|
vvp_mangle_id(ivl_lpm_name(lpm)), idx);
|
2001-06-07 04:12:43 +02:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-15 06:14:18 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case IVL_LPM_CMP_GE:
|
|
|
|
|
case IVL_LPM_CMP_GT:
|
2001-09-14 06:15:46 +02:00
|
|
|
case IVL_LPM_CMP_EQ:
|
|
|
|
|
case IVL_LPM_CMP_NE:
|
2001-06-15 06:14:18 +02:00
|
|
|
if (ivl_lpm_q(lpm, 0) == nex) {
|
2001-06-18 05:10:34 +02:00
|
|
|
sprintf(result, "L_%s", vvp_mangle_id(ivl_lpm_name(lpm)));
|
2001-06-15 06:14:18 +02:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2001-05-12 05:31:01 +02:00
|
|
|
}
|
2001-04-30 01:16:31 +02:00
|
|
|
|
2001-06-17 01:45:05 +02:00
|
|
|
fprintf(stderr, "internal error: no input to nexus %s\n",
|
|
|
|
|
ivl_nexus_name(nex));
|
2001-05-12 05:31:01 +02:00
|
|
|
assert(0);
|
2001-06-17 01:45:05 +02:00
|
|
|
return "C<z>";
|
2001-05-12 05:31:01 +02:00
|
|
|
}
|
|
|
|
|
|
2001-08-10 02:40:45 +02:00
|
|
|
/*
|
|
|
|
|
* This function draws the input to a net. What that means is that it
|
|
|
|
|
* returns a static string that can be used to represent a resolved
|
|
|
|
|
* driver to a nexus. If there are multiple drivers to the nexus, then
|
|
|
|
|
* it writes out the resolver declarations needed to perform strength
|
|
|
|
|
* resolution.
|
|
|
|
|
*
|
|
|
|
|
* The string that this returns must be copied out before this
|
|
|
|
|
* function is called again. Otherwise, the string memory will be
|
|
|
|
|
* overwritten.
|
|
|
|
|
*/
|
2001-05-12 05:31:01 +02:00
|
|
|
static const char* draw_net_input(ivl_nexus_t nex)
|
|
|
|
|
{
|
2001-08-10 02:40:45 +02:00
|
|
|
char result[512];
|
2001-05-12 05:31:01 +02:00
|
|
|
unsigned idx;
|
2001-07-16 20:31:49 +02:00
|
|
|
int level;
|
2001-05-12 05:31:01 +02:00
|
|
|
unsigned ndrivers = 0;
|
2001-07-18 04:44:39 +02:00
|
|
|
static ivl_nexus_ptr_t *drivers = 0x0;
|
|
|
|
|
static unsigned adrivers = 0;
|
2001-05-12 05:31:01 +02:00
|
|
|
|
2001-08-10 02:40:45 +02:00
|
|
|
/* If this nexus already has a label, then its input is
|
|
|
|
|
already figured out. Just return the existing label. */
|
2001-09-14 06:15:46 +02:00
|
|
|
char*nex_private = (char*)ivl_nexus_get_private(nex);
|
2001-08-10 02:40:45 +02:00
|
|
|
if (nex_private)
|
|
|
|
|
return nex_private;
|
|
|
|
|
|
|
|
|
|
|
2001-05-12 05:31:01 +02:00
|
|
|
for (idx = 0 ; idx < ivl_nexus_ptrs(nex) ; idx += 1) {
|
|
|
|
|
ivl_nexus_ptr_t nptr = ivl_nexus_ptr(nex, idx);
|
2001-04-30 01:16:31 +02:00
|
|
|
|
2001-05-12 05:31:01 +02:00
|
|
|
/* Skip input only pins. */
|
|
|
|
|
if ((ivl_nexus_ptr_drive0(nptr) == IVL_DR_HiZ)
|
|
|
|
|
&& (ivl_nexus_ptr_drive1(nptr) == IVL_DR_HiZ))
|
2001-04-30 02:00:27 +02:00
|
|
|
continue;
|
2001-04-26 07:12:02 +02:00
|
|
|
|
2001-05-12 05:31:01 +02:00
|
|
|
/* Save this driver. */
|
2001-07-18 04:44:39 +02:00
|
|
|
if (ndrivers >= adrivers) {
|
|
|
|
|
adrivers += 4;
|
|
|
|
|
drivers = (ivl_nexus_ptr_t*)
|
|
|
|
|
realloc(drivers, adrivers*sizeof(ivl_nexus_ptr_t));
|
|
|
|
|
assert(drivers);
|
|
|
|
|
}
|
2001-05-12 05:31:01 +02:00
|
|
|
drivers[ndrivers] = nptr;
|
|
|
|
|
ndrivers += 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If the nexus has no drivers, then send a constant HiZ into
|
|
|
|
|
the net. */
|
2001-08-10 02:40:45 +02:00
|
|
|
if (ndrivers == 0) {
|
|
|
|
|
nex_private = "C<z>";
|
|
|
|
|
ivl_nexus_set_private(nex, nex_private);
|
|
|
|
|
return nex_private;
|
|
|
|
|
}
|
2001-04-26 07:12:02 +02:00
|
|
|
|
2001-04-30 01:16:31 +02:00
|
|
|
|
2001-05-12 05:31:01 +02:00
|
|
|
/* If the nexus has exactly one driver, then simply draw it. */
|
2001-08-10 02:40:45 +02:00
|
|
|
if (ndrivers == 1) {
|
|
|
|
|
nex_private = strdup(draw_net_input_drive(nex, drivers[0]));
|
|
|
|
|
ivl_nexus_set_private(nex, nex_private);
|
|
|
|
|
return nex_private;
|
|
|
|
|
}
|
2001-04-26 07:12:02 +02:00
|
|
|
|
2001-07-16 20:31:49 +02:00
|
|
|
level = 0;
|
|
|
|
|
while (ndrivers) {
|
|
|
|
|
int inst;
|
|
|
|
|
for (inst = 0; inst < ndrivers; inst += 4) {
|
|
|
|
|
if (ndrivers > 4)
|
|
|
|
|
fprintf(vvp_out, "RS_%s/%d/%d .resolv tri",
|
|
|
|
|
vvp_mangle_id(ivl_nexus_name(nex)),
|
|
|
|
|
level, inst);
|
|
|
|
|
else
|
|
|
|
|
fprintf(vvp_out, "RS_%s .resolv tri",
|
|
|
|
|
vvp_mangle_id(ivl_nexus_name(nex)));
|
|
|
|
|
|
|
|
|
|
for (idx = inst; idx < ndrivers && idx < inst+4; idx += 1) {
|
|
|
|
|
if (level) {
|
|
|
|
|
fprintf(vvp_out, ", RS_%s/%d/%d",
|
|
|
|
|
vvp_mangle_id(ivl_nexus_name(nex)),
|
|
|
|
|
level - 1,
|
|
|
|
|
idx*4);
|
|
|
|
|
} else {
|
|
|
|
|
fprintf(vvp_out, ", %s",
|
|
|
|
|
draw_net_input_drive(nex, drivers[idx]));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for ( ; idx < inst+4 ; idx += 1)
|
|
|
|
|
fprintf(vvp_out, ", C<z>");
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out, ";\n");
|
|
|
|
|
}
|
|
|
|
|
if (ndrivers > 4)
|
|
|
|
|
ndrivers = (ndrivers+3) / 4;
|
|
|
|
|
else
|
|
|
|
|
ndrivers = 0;
|
|
|
|
|
level += 1;
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-18 05:10:34 +02:00
|
|
|
sprintf(result, "RS_%s", vvp_mangle_id(ivl_nexus_name(nex)));
|
2001-08-10 02:40:45 +02:00
|
|
|
nex_private = strdup(result);
|
|
|
|
|
ivl_nexus_set_private(nex, nex_private);
|
|
|
|
|
return nex_private;
|
2001-03-25 05:25:43 +02:00
|
|
|
}
|
|
|
|
|
|
2001-05-12 05:31:01 +02:00
|
|
|
|
|
|
|
|
|
2001-05-06 02:01:02 +02:00
|
|
|
/*
|
2001-08-10 02:40:45 +02:00
|
|
|
* This function looks at the nexus in search of the net to attach
|
2001-05-06 02:01:02 +02:00
|
|
|
* functor inputs to. Sort the signals in the nexus by name, and
|
|
|
|
|
* choose the lexically earliest one.
|
|
|
|
|
*/
|
2001-08-10 02:40:45 +02:00
|
|
|
static void draw_input_from_net(ivl_nexus_t nex)
|
2001-05-06 02:01:02 +02:00
|
|
|
{
|
2001-08-10 02:40:45 +02:00
|
|
|
const char*nex_private = (const char*)ivl_nexus_get_private(nex);
|
|
|
|
|
if (nex_private == 0)
|
|
|
|
|
nex_private = draw_net_input(nex);
|
|
|
|
|
assert(nex_private);
|
|
|
|
|
fprintf(vvp_out, "%s", nex_private);
|
2001-05-06 02:01:02 +02:00
|
|
|
}
|
|
|
|
|
|
2001-03-25 05:25:43 +02:00
|
|
|
/*
|
|
|
|
|
* This function draws a reg/int/variable in the scope. This is a very
|
|
|
|
|
* simple device to draw as there are no inputs to connect so no need
|
|
|
|
|
* to scan the nexus.
|
|
|
|
|
*/
|
|
|
|
|
static void draw_reg_in_scope(ivl_signal_t sig)
|
|
|
|
|
{
|
2001-08-10 02:40:45 +02:00
|
|
|
unsigned idx;
|
2001-03-25 05:25:43 +02:00
|
|
|
int msb = ivl_signal_pins(sig) - 1;
|
|
|
|
|
int lsb = 0;
|
|
|
|
|
|
2001-04-05 03:38:24 +02:00
|
|
|
const char*signed_flag = ivl_signal_signed(sig)? "/s" : "";
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out, "V_%s .var%s \"%s\", %d, %d;\n",
|
2001-06-18 05:10:34 +02:00
|
|
|
vvp_mangle_id(ivl_signal_name(sig)), signed_flag,
|
|
|
|
|
vvp_mangle_name(ivl_signal_basename(sig)), msb, lsb);
|
2001-05-06 02:01:02 +02:00
|
|
|
|
2001-08-10 02:40:45 +02:00
|
|
|
/* Attach input information to the nexus. */
|
|
|
|
|
for (idx = 0 ; idx < ivl_signal_pins(sig) ; idx += 1) {
|
|
|
|
|
ivl_nexus_t nex = ivl_signal_pin(sig, idx);
|
|
|
|
|
draw_net_input(nex);
|
2001-05-06 02:01:02 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-25 05:25:43 +02:00
|
|
|
/*
|
|
|
|
|
* This function draws a net. This is a bit more complicated as we
|
|
|
|
|
* have to find an appropriate functor to connect to the input.
|
|
|
|
|
*/
|
|
|
|
|
static void draw_net_in_scope(ivl_signal_t sig)
|
|
|
|
|
{
|
|
|
|
|
unsigned idx;
|
|
|
|
|
int msb = ivl_signal_pins(sig) - 1;
|
|
|
|
|
int lsb = 0;
|
2001-05-12 05:31:01 +02:00
|
|
|
char**args;
|
2001-03-25 05:25:43 +02:00
|
|
|
|
2001-04-05 03:38:24 +02:00
|
|
|
const char*signed_flag = ivl_signal_signed(sig)? "/s" : "";
|
|
|
|
|
|
2001-05-12 05:31:01 +02:00
|
|
|
args = (char**)calloc(ivl_signal_pins(sig), sizeof(char*));
|
2001-03-25 05:25:43 +02:00
|
|
|
|
2001-05-06 02:01:02 +02:00
|
|
|
/* Connect all the pins of the signal to something. */
|
2001-03-25 05:25:43 +02:00
|
|
|
for (idx = 0 ; idx < ivl_signal_pins(sig) ; idx += 1) {
|
|
|
|
|
ivl_nexus_t nex = ivl_signal_pin(sig, idx);
|
2001-05-06 02:01:02 +02:00
|
|
|
|
2001-08-10 02:40:45 +02:00
|
|
|
args[idx] = draw_net_input(nex);
|
2001-03-25 05:25:43 +02:00
|
|
|
}
|
|
|
|
|
|
2001-06-18 05:10:34 +02:00
|
|
|
fprintf(vvp_out, "V_%s .net%s \"%s\", %d, %d",
|
|
|
|
|
vvp_mangle_id(ivl_signal_name(sig)), signed_flag,
|
|
|
|
|
vvp_mangle_name(ivl_signal_basename(sig)), msb, lsb);
|
|
|
|
|
for (idx = 0 ; idx < ivl_signal_pins(sig) ; idx += 1) {
|
2001-05-12 05:31:01 +02:00
|
|
|
fprintf(vvp_out, ", %s", args[idx]);
|
2001-06-18 05:10:34 +02:00
|
|
|
}
|
2001-03-25 05:25:43 +02:00
|
|
|
fprintf(vvp_out, ";\n");
|
2001-05-12 05:31:01 +02:00
|
|
|
|
|
|
|
|
free(args);
|
2001-03-25 05:25:43 +02:00
|
|
|
}
|
|
|
|
|
|
2001-04-24 04:23:58 +02:00
|
|
|
static void draw_udp_def(ivl_udp_t udp)
|
|
|
|
|
{
|
|
|
|
|
unsigned init;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
switch (ivl_udp_init(udp))
|
|
|
|
|
{
|
|
|
|
|
case '0':
|
|
|
|
|
init = 0;
|
|
|
|
|
break;
|
|
|
|
|
case '1':
|
|
|
|
|
init = 1;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
init = 2;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-24 04:59:52 +02:00
|
|
|
if (ivl_udp_sequ(udp))
|
|
|
|
|
fprintf(vvp_out,
|
|
|
|
|
"UDP_%s .udp/sequ \"%s\", %d, %d",
|
2001-06-18 05:10:34 +02:00
|
|
|
vvp_mangle_id(ivl_udp_name(udp)),
|
|
|
|
|
vvp_mangle_name(ivl_udp_name(udp)),
|
2001-04-24 04:59:52 +02:00
|
|
|
ivl_udp_nin(udp),
|
|
|
|
|
init );
|
|
|
|
|
else
|
|
|
|
|
fprintf(vvp_out,
|
|
|
|
|
"UDP_%s .udp/comb \"%s\", %d",
|
2001-06-18 05:10:34 +02:00
|
|
|
vvp_mangle_id(ivl_udp_name(udp)),
|
|
|
|
|
vvp_mangle_name(ivl_udp_name(udp)),
|
2001-04-24 04:59:52 +02:00
|
|
|
ivl_udp_nin(udp));
|
2001-04-24 04:23:58 +02:00
|
|
|
|
|
|
|
|
for (i=0; i<ivl_udp_rows(udp); i++)
|
|
|
|
|
fprintf(vvp_out, "\n ,\"%s\"", ivl_udp_row(udp, i) );
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out, ";\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void draw_udp_in_scope(ivl_net_logic_t lptr)
|
|
|
|
|
{
|
|
|
|
|
unsigned pdx;
|
|
|
|
|
|
|
|
|
|
ivl_udp_t udp = ivl_logic_udp(lptr);
|
|
|
|
|
|
|
|
|
|
static ivl_udp_t *udps = 0x0;
|
|
|
|
|
static int nudps = 0;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for (i=0; i<nudps; i++)
|
|
|
|
|
if (udps[i] == udp)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
if (i >= nudps)
|
|
|
|
|
{
|
|
|
|
|
udps = (ivl_udp_t*)realloc(udps, (nudps+1)*sizeof(ivl_udp_t));
|
|
|
|
|
assert(udps);
|
|
|
|
|
udps[nudps++] = udp;
|
|
|
|
|
draw_udp_def(udp);
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-18 05:10:34 +02:00
|
|
|
fprintf(vvp_out, "L_%s .udp",
|
|
|
|
|
vvp_mangle_id(ivl_logic_name(lptr)));
|
|
|
|
|
fprintf(vvp_out, " UDP_%s",
|
|
|
|
|
vvp_mangle_id(ivl_udp_name(udp)));
|
2001-04-24 04:23:58 +02:00
|
|
|
|
|
|
|
|
for (pdx = 1 ; pdx < ivl_logic_pins(lptr) ; pdx += 1)
|
|
|
|
|
{
|
|
|
|
|
ivl_nexus_t nex = ivl_logic_pin(lptr, pdx);
|
|
|
|
|
fprintf(vvp_out, ", ");
|
2001-05-06 02:01:02 +02:00
|
|
|
draw_input_from_net(nex);
|
2001-04-24 04:23:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out, ";\n");
|
|
|
|
|
}
|
|
|
|
|
|
2001-03-27 08:27:40 +02:00
|
|
|
static void draw_logic_in_scope(ivl_net_logic_t lptr)
|
|
|
|
|
{
|
2001-06-18 05:10:34 +02:00
|
|
|
unsigned pdx;
|
2001-03-27 08:27:40 +02:00
|
|
|
const char*ltype = "?";
|
2001-06-18 05:10:34 +02:00
|
|
|
const char*lcasc = 0x0;
|
2001-05-02 06:05:16 +02:00
|
|
|
char identity_val = '0';
|
2001-06-18 05:10:34 +02:00
|
|
|
int level;
|
|
|
|
|
int ninp;
|
2001-04-24 04:23:58 +02:00
|
|
|
|
|
|
|
|
switch (ivl_logic_type(lptr)) {
|
|
|
|
|
|
|
|
|
|
case IVL_LO_UDP:
|
|
|
|
|
draw_udp_in_scope(lptr);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case IVL_LO_BUFZ:
|
2001-03-27 08:27:40 +02:00
|
|
|
/* Skip BUFZ objects. Things that have a bufz as input
|
|
|
|
|
will use the input to bufz instead. */
|
|
|
|
|
return;
|
|
|
|
|
|
2001-04-30 01:16:31 +02:00
|
|
|
case IVL_LO_PULLDOWN:
|
|
|
|
|
case IVL_LO_PULLUP:
|
|
|
|
|
/* Skip pullup and pulldown objects. Things that have
|
|
|
|
|
pull objects as inputs will instead generate the
|
|
|
|
|
appropriate C<?> symbol. */
|
|
|
|
|
return;
|
|
|
|
|
|
2001-03-27 08:27:40 +02:00
|
|
|
case IVL_LO_AND:
|
|
|
|
|
ltype = "AND";
|
2001-05-02 06:05:16 +02:00
|
|
|
identity_val = '1';
|
2001-03-27 08:27:40 +02:00
|
|
|
break;
|
|
|
|
|
|
2001-04-01 23:34:48 +02:00
|
|
|
case IVL_LO_BUF:
|
|
|
|
|
ltype = "BUF";
|
|
|
|
|
break;
|
|
|
|
|
|
2001-04-30 01:16:31 +02:00
|
|
|
case IVL_LO_BUFIF0:
|
|
|
|
|
ltype = "BUFIF0";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IVL_LO_BUFIF1:
|
|
|
|
|
ltype = "BUFIF1";
|
|
|
|
|
break;
|
|
|
|
|
|
2001-04-21 04:04:01 +02:00
|
|
|
case IVL_LO_NAND:
|
|
|
|
|
ltype = "NAND";
|
2001-06-18 05:10:34 +02:00
|
|
|
lcasc = "AND";
|
2001-05-02 06:05:16 +02:00
|
|
|
identity_val = '1';
|
2001-04-21 04:04:01 +02:00
|
|
|
break;
|
|
|
|
|
|
2001-03-27 08:27:40 +02:00
|
|
|
case IVL_LO_NOR:
|
|
|
|
|
ltype = "NOR";
|
2001-06-18 05:10:34 +02:00
|
|
|
lcasc = "OR";
|
2001-03-27 08:27:40 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IVL_LO_NOT:
|
|
|
|
|
ltype = "NOT";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IVL_LO_OR:
|
|
|
|
|
ltype = "OR";
|
|
|
|
|
break;
|
|
|
|
|
|
2001-04-21 04:04:01 +02:00
|
|
|
case IVL_LO_XNOR:
|
|
|
|
|
ltype = "XNOR";
|
2001-06-18 05:10:34 +02:00
|
|
|
lcasc = "XOR";
|
2001-04-21 04:04:01 +02:00
|
|
|
break;
|
|
|
|
|
|
2001-04-15 18:37:48 +02:00
|
|
|
case IVL_LO_XOR:
|
|
|
|
|
ltype = "XOR";
|
|
|
|
|
break;
|
|
|
|
|
|
2001-06-19 05:01:10 +02:00
|
|
|
case IVL_LO_EEQ:
|
|
|
|
|
ltype = "EEQ";
|
|
|
|
|
break;
|
|
|
|
|
|
2001-08-03 19:06:10 +02:00
|
|
|
case IVL_LO_PMOS:
|
2001-10-09 04:28:44 +02:00
|
|
|
ltype = "PMOS";
|
2001-08-03 19:06:10 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IVL_LO_NMOS:
|
2001-10-09 04:28:44 +02:00
|
|
|
ltype = "NMOS";
|
2001-08-03 19:06:10 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IVL_LO_RPMOS:
|
2001-10-18 19:30:25 +02:00
|
|
|
ltype = "RPMOS";
|
2001-08-03 19:06:10 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IVL_LO_RNMOS:
|
2001-10-18 19:30:25 +02:00
|
|
|
ltype = "RNMOS";
|
2001-08-03 19:06:10 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IVL_LO_NOTIF0:
|
|
|
|
|
fprintf(stderr, "vvp.tgt: error: Unhandled logic of type NOTIF0\n");
|
|
|
|
|
ltype = "?";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case IVL_LO_NOTIF1:
|
|
|
|
|
fprintf(stderr, "vvp.tgt: error: Unhandled logic of type NOTIF1\n");
|
|
|
|
|
ltype = "?";
|
|
|
|
|
break;
|
|
|
|
|
|
2001-03-27 08:27:40 +02:00
|
|
|
default:
|
2001-04-30 01:16:31 +02:00
|
|
|
fprintf(stderr, "vvp.tgt: error: Unhandled logic type: %u\n",
|
|
|
|
|
ivl_logic_type(lptr));
|
2001-03-27 08:27:40 +02:00
|
|
|
ltype = "?";
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-18 05:10:34 +02:00
|
|
|
if (!lcasc)
|
|
|
|
|
lcasc = ltype;
|
|
|
|
|
|
|
|
|
|
level = 0;
|
|
|
|
|
ninp = ivl_logic_pins(lptr) - 1;
|
|
|
|
|
while (ninp) {
|
|
|
|
|
int inst;
|
|
|
|
|
for (inst = 0; inst < ninp; inst += 4) {
|
|
|
|
|
if (ninp > 4)
|
|
|
|
|
fprintf(vvp_out, "L_%s/%d/%d .functor %s",
|
|
|
|
|
vvp_mangle_id(ivl_logic_name(lptr)),
|
|
|
|
|
level, inst,
|
|
|
|
|
lcasc);
|
|
|
|
|
else
|
|
|
|
|
fprintf(vvp_out, "L_%s .functor %s",
|
|
|
|
|
vvp_mangle_id(ivl_logic_name(lptr)),
|
|
|
|
|
ltype);
|
|
|
|
|
for (pdx = inst; pdx < ninp && pdx < inst+4 ; pdx += 1) {
|
|
|
|
|
if (level) {
|
|
|
|
|
fprintf(vvp_out, ", L_%s/%d/%d",
|
|
|
|
|
vvp_mangle_id(ivl_logic_name(lptr)),
|
|
|
|
|
level - 1,
|
2001-07-09 17:38:35 +02:00
|
|
|
pdx*4 );
|
2001-06-18 05:10:34 +02:00
|
|
|
} else {
|
|
|
|
|
ivl_nexus_t nex = ivl_logic_pin(lptr, pdx+1);
|
|
|
|
|
fprintf(vvp_out, ", ");
|
|
|
|
|
draw_input_from_net(nex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for ( ; pdx < inst+4 ; pdx += 1) {
|
|
|
|
|
fprintf(vvp_out, ", C<%c>", identity_val);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out, ";\n");
|
|
|
|
|
}
|
|
|
|
|
if (ninp > 4)
|
|
|
|
|
ninp = (ninp+3) / 4;
|
|
|
|
|
else
|
|
|
|
|
ninp = 0;
|
2001-07-09 17:38:35 +02:00
|
|
|
level += 1;
|
2001-05-02 06:05:16 +02:00
|
|
|
}
|
2001-03-27 08:27:40 +02:00
|
|
|
}
|
|
|
|
|
|
2001-03-28 08:07:39 +02:00
|
|
|
static void draw_event_in_scope(ivl_event_t obj)
|
|
|
|
|
{
|
2001-04-01 03:48:21 +02:00
|
|
|
unsigned nany = ivl_event_nany(obj);
|
|
|
|
|
unsigned nneg = ivl_event_nneg(obj);
|
|
|
|
|
unsigned npos = ivl_event_npos(obj);
|
2001-04-14 07:11:49 +02:00
|
|
|
|
2001-05-03 06:55:46 +02:00
|
|
|
unsigned cnt = 0;
|
|
|
|
|
|
|
|
|
|
/* Figure out how many probe functors are needed. */
|
|
|
|
|
if (nany > 0)
|
|
|
|
|
cnt += (nany+3) / 4;
|
|
|
|
|
|
|
|
|
|
if (nneg > 0)
|
|
|
|
|
cnt += (nneg+3) / 4;
|
|
|
|
|
|
|
|
|
|
if (npos > 0)
|
|
|
|
|
cnt += (npos+3) / 4;
|
|
|
|
|
|
|
|
|
|
if (cnt == 0) {
|
|
|
|
|
/* If none are needed, then this is a named event. The
|
|
|
|
|
code needed is easy. */
|
2001-03-28 08:07:39 +02:00
|
|
|
fprintf(vvp_out, "E_%s .event \"%s\";\n",
|
2001-06-18 05:10:34 +02:00
|
|
|
vvp_mangle_id(ivl_event_name(obj)),
|
|
|
|
|
vvp_mangle_name(ivl_event_basename(obj)));
|
2001-03-28 08:07:39 +02:00
|
|
|
|
2001-05-03 06:55:46 +02:00
|
|
|
} else if (cnt > 1) {
|
2001-04-14 07:11:49 +02:00
|
|
|
unsigned idx;
|
2001-05-03 06:55:46 +02:00
|
|
|
unsigned ecnt = 0;
|
2001-04-14 07:11:49 +02:00
|
|
|
|
2001-05-03 06:55:46 +02:00
|
|
|
for (idx = 0 ; idx < nany ; idx += 4, ecnt += 1) {
|
2001-04-14 07:11:49 +02:00
|
|
|
unsigned sub, top;
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out, "E_%s/%u .event edge",
|
2001-06-18 05:10:34 +02:00
|
|
|
vvp_mangle_id(ivl_event_name(obj)), ecnt);
|
|
|
|
|
|
2001-04-14 07:11:49 +02:00
|
|
|
top = idx + 4;
|
|
|
|
|
if (nany < top)
|
|
|
|
|
top = nany;
|
|
|
|
|
for (sub = idx ; sub < top ; sub += 1) {
|
|
|
|
|
ivl_nexus_t nex = ivl_event_any(obj, sub);
|
|
|
|
|
fprintf(vvp_out, ", ");
|
2001-05-06 02:01:02 +02:00
|
|
|
draw_input_from_net(nex);
|
2001-04-14 07:11:49 +02:00
|
|
|
}
|
|
|
|
|
fprintf(vvp_out, ";\n");
|
|
|
|
|
}
|
|
|
|
|
|
2001-05-03 06:55:46 +02:00
|
|
|
for (idx = 0 ; idx < nneg ; idx += 4, ecnt += 1) {
|
|
|
|
|
unsigned sub, top;
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out, "E_%s/%u .event negedge",
|
2001-06-18 05:10:34 +02:00
|
|
|
vvp_mangle_id(ivl_event_name(obj)), ecnt);
|
2001-05-03 06:55:46 +02:00
|
|
|
|
|
|
|
|
top = idx + 4;
|
|
|
|
|
if (nneg < top)
|
|
|
|
|
top = nneg;
|
|
|
|
|
for (sub = idx ; sub < top ; sub += 1) {
|
|
|
|
|
ivl_nexus_t nex = ivl_event_neg(obj, sub);
|
|
|
|
|
fprintf(vvp_out, ", ");
|
2001-05-06 02:01:02 +02:00
|
|
|
draw_input_from_net(nex);
|
2001-05-03 06:55:46 +02:00
|
|
|
}
|
|
|
|
|
fprintf(vvp_out, ";\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (idx = 0 ; idx < npos ; idx += 4, ecnt += 1) {
|
|
|
|
|
unsigned sub, top;
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out, "E_%s/%u .event posedge",
|
2001-06-18 05:10:34 +02:00
|
|
|
vvp_mangle_id(ivl_event_name(obj)), ecnt);
|
2001-05-03 06:55:46 +02:00
|
|
|
|
|
|
|
|
top = idx + 4;
|
|
|
|
|
if (npos < top)
|
|
|
|
|
top = npos;
|
|
|
|
|
for (sub = idx ; sub < top ; sub += 1) {
|
|
|
|
|
ivl_nexus_t nex = ivl_event_pos(obj, sub);
|
|
|
|
|
fprintf(vvp_out, ", ");
|
2001-05-06 02:01:02 +02:00
|
|
|
draw_input_from_net(nex);
|
2001-05-03 06:55:46 +02:00
|
|
|
}
|
|
|
|
|
fprintf(vvp_out, ";\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
assert(ecnt == cnt);
|
|
|
|
|
|
2001-06-18 05:10:34 +02:00
|
|
|
fprintf(vvp_out, "E_%s .event/or",
|
|
|
|
|
vvp_mangle_id(ivl_event_name(obj)));
|
|
|
|
|
fprintf(vvp_out, " E_%s/0",
|
|
|
|
|
vvp_mangle_id(ivl_event_name(obj)));
|
2001-04-14 07:11:49 +02:00
|
|
|
|
2001-05-03 06:55:46 +02:00
|
|
|
for (idx = 1 ; idx < cnt ; idx += 1)
|
2001-06-18 05:10:34 +02:00
|
|
|
fprintf(vvp_out, ", E_%s/%u",
|
|
|
|
|
vvp_mangle_id(ivl_event_name(obj)), idx);
|
|
|
|
|
|
2001-04-14 07:11:49 +02:00
|
|
|
fprintf(vvp_out, ";\n");
|
2001-06-18 05:10:34 +02:00
|
|
|
|
2001-03-28 08:07:39 +02:00
|
|
|
} else {
|
|
|
|
|
unsigned idx;
|
2001-06-18 05:10:34 +02:00
|
|
|
|
|
|
|
|
fprintf(vvp_out, "E_%s .event ",
|
|
|
|
|
vvp_mangle_id(ivl_event_name(obj)));
|
2001-04-01 03:48:21 +02:00
|
|
|
|
|
|
|
|
if (nany > 0) {
|
|
|
|
|
assert((nneg + npos) == 0);
|
|
|
|
|
assert(nany <= 4);
|
2001-06-18 05:10:34 +02:00
|
|
|
|
2001-03-28 08:07:39 +02:00
|
|
|
fprintf(vvp_out, "edge");
|
2001-06-18 05:10:34 +02:00
|
|
|
|
2001-04-01 03:48:21 +02:00
|
|
|
for (idx = 0 ; idx < nany ; idx += 1) {
|
|
|
|
|
ivl_nexus_t nex = ivl_event_any(obj, idx);
|
|
|
|
|
fprintf(vvp_out, ", ");
|
2001-05-06 02:01:02 +02:00
|
|
|
draw_input_from_net(nex);
|
2001-04-01 03:48:21 +02:00
|
|
|
}
|
2001-06-18 05:10:34 +02:00
|
|
|
|
2001-04-01 03:48:21 +02:00
|
|
|
} else if (nneg > 0) {
|
|
|
|
|
assert((nany + npos) == 0);
|
|
|
|
|
fprintf(vvp_out, "negedge");
|
|
|
|
|
|
|
|
|
|
for (idx = 0 ; idx < nneg ; idx += 1) {
|
|
|
|
|
ivl_nexus_t nex = ivl_event_neg(obj, idx);
|
|
|
|
|
fprintf(vvp_out, ", ");
|
2001-05-06 02:01:02 +02:00
|
|
|
draw_input_from_net(nex);
|
2001-04-01 03:48:21 +02:00
|
|
|
}
|
2001-06-18 05:10:34 +02:00
|
|
|
|
2001-04-01 03:48:21 +02:00
|
|
|
} else {
|
|
|
|
|
assert((nany + nneg) == 0);
|
|
|
|
|
fprintf(vvp_out, "posedge");
|
2001-06-18 05:10:34 +02:00
|
|
|
|
2001-04-01 03:48:21 +02:00
|
|
|
for (idx = 0 ; idx < npos ; idx += 1) {
|
|
|
|
|
ivl_nexus_t nex = ivl_event_pos(obj, idx);
|
|
|
|
|
fprintf(vvp_out, ", ");
|
2001-05-06 02:01:02 +02:00
|
|
|
draw_input_from_net(nex);
|
2001-04-01 03:48:21 +02:00
|
|
|
}
|
2001-03-28 08:07:39 +02:00
|
|
|
}
|
2001-06-18 05:10:34 +02:00
|
|
|
|
2001-03-28 08:07:39 +02:00
|
|
|
fprintf(vvp_out, ";\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-16 04:41:41 +02:00
|
|
|
inline static void draw_lpm_ram(ivl_lpm_t net)
|
|
|
|
|
{
|
|
|
|
|
unsigned idx;
|
|
|
|
|
unsigned width = ivl_lpm_width(net);
|
|
|
|
|
unsigned awidth = ivl_lpm_selects(net);
|
|
|
|
|
ivl_memory_t mem = ivl_lpm_memory(net);
|
|
|
|
|
ivl_nexus_t clk = ivl_lpm_clk(net);
|
|
|
|
|
ivl_nexus_t pin;
|
|
|
|
|
|
|
|
|
|
if (clk) {
|
|
|
|
|
fprintf(vvp_out,
|
|
|
|
|
"CLK_%s .event posedge, ",
|
2001-06-18 05:10:34 +02:00
|
|
|
vvp_mangle_id(ivl_lpm_name(net)));
|
2001-06-16 04:41:41 +02:00
|
|
|
draw_input_from_net(pin);
|
|
|
|
|
fprintf(vvp_out, ";\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out,
|
2001-06-18 05:10:34 +02:00
|
|
|
"L_%s .mem/port",
|
|
|
|
|
vvp_mangle_id(ivl_lpm_name(net)));
|
|
|
|
|
fprintf(vvp_out,
|
|
|
|
|
" M_%s, %d,0, %d,\n ",
|
|
|
|
|
vvp_mangle_id(ivl_memory_name(mem)),
|
2001-06-16 04:41:41 +02:00
|
|
|
width-1,
|
|
|
|
|
awidth);
|
|
|
|
|
|
|
|
|
|
for (idx = 0 ; idx < awidth ; idx += 1) {
|
|
|
|
|
pin = ivl_lpm_select(net, idx);
|
|
|
|
|
if (idx) fprintf(vvp_out, ", ");
|
|
|
|
|
draw_input_from_net(pin);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (clk) {
|
2001-06-18 05:10:34 +02:00
|
|
|
fprintf(vvp_out, ",\n CLK_%s, ",
|
|
|
|
|
vvp_mangle_id(ivl_lpm_name(net)));
|
2001-06-16 04:41:41 +02:00
|
|
|
pin = ivl_lpm_enable(net);
|
|
|
|
|
if (pin)
|
|
|
|
|
draw_input_from_net(pin);
|
|
|
|
|
else
|
|
|
|
|
fprintf(vvp_out, "C<1>");
|
|
|
|
|
for (idx=0; idx<width; idx++) {
|
|
|
|
|
pin = ivl_lpm_data(net, idx);
|
|
|
|
|
fprintf(vvp_out, ", ");
|
|
|
|
|
draw_input_from_net(pin);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out, ";\n");
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-15 06:14:18 +02:00
|
|
|
static void draw_lpm_arith_a_b_inputs(ivl_lpm_t net)
|
|
|
|
|
{
|
|
|
|
|
unsigned width = ivl_lpm_width(net);
|
|
|
|
|
unsigned idx;
|
|
|
|
|
for (idx = 0 ; idx < width ; idx += 1) {
|
|
|
|
|
ivl_nexus_t a = ivl_lpm_data(net, idx);
|
|
|
|
|
if (a) {
|
|
|
|
|
fprintf(vvp_out, ", ");
|
|
|
|
|
draw_input_from_net(a);
|
|
|
|
|
} else {
|
|
|
|
|
fprintf(vvp_out, ", C<0>");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (idx = 0 ; idx < width ; idx += 1) {
|
|
|
|
|
ivl_nexus_t b = ivl_lpm_datab(net, idx);
|
|
|
|
|
if (b) {
|
|
|
|
|
fprintf(vvp_out, ", ");
|
|
|
|
|
draw_input_from_net(b);
|
|
|
|
|
} else {
|
|
|
|
|
fprintf(vvp_out, ", C<0>");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-07 04:12:43 +02:00
|
|
|
static void draw_lpm_add(ivl_lpm_t net)
|
|
|
|
|
{
|
2001-06-15 06:14:18 +02:00
|
|
|
unsigned width;
|
2001-06-07 05:09:37 +02:00
|
|
|
const char*type = "";
|
2001-06-07 04:12:43 +02:00
|
|
|
|
|
|
|
|
width = ivl_lpm_width(net);
|
|
|
|
|
|
2001-06-07 05:09:37 +02:00
|
|
|
switch (ivl_lpm_type(net)) {
|
|
|
|
|
case IVL_LPM_ADD:
|
|
|
|
|
type = "sum";
|
|
|
|
|
break;
|
|
|
|
|
case IVL_LPM_SUB:
|
|
|
|
|
type = "sub";
|
|
|
|
|
break;
|
2001-06-17 01:45:05 +02:00
|
|
|
case IVL_LPM_MULT:
|
|
|
|
|
type = "mult";
|
|
|
|
|
break;
|
2001-10-16 04:19:26 +02:00
|
|
|
case IVL_LPM_DIVIDE:
|
|
|
|
|
type = "div";
|
|
|
|
|
break;
|
2001-06-07 05:09:37 +02:00
|
|
|
default:
|
|
|
|
|
assert(0);
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-18 05:10:34 +02:00
|
|
|
fprintf(vvp_out, "L_%s .arith/%s %u",
|
|
|
|
|
vvp_mangle_id(ivl_lpm_name(net)), type, width);
|
2001-06-07 04:12:43 +02:00
|
|
|
|
2001-06-15 06:14:18 +02:00
|
|
|
draw_lpm_arith_a_b_inputs(net);
|
2001-06-07 04:12:43 +02:00
|
|
|
|
2001-06-15 06:14:18 +02:00
|
|
|
fprintf(vvp_out, ";\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void draw_lpm_cmp(ivl_lpm_t net)
|
|
|
|
|
{
|
|
|
|
|
unsigned width;
|
|
|
|
|
const char*type = "";
|
|
|
|
|
|
|
|
|
|
width = ivl_lpm_width(net);
|
|
|
|
|
|
|
|
|
|
switch (ivl_lpm_type(net)) {
|
|
|
|
|
case IVL_LPM_CMP_GE:
|
|
|
|
|
type = "ge";
|
|
|
|
|
break;
|
|
|
|
|
case IVL_LPM_CMP_GT:
|
|
|
|
|
type = "gt";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
assert(0);
|
2001-06-07 04:12:43 +02:00
|
|
|
}
|
|
|
|
|
|
2001-06-18 05:10:34 +02:00
|
|
|
fprintf(vvp_out, "L_%s .cmp/%s %u",
|
|
|
|
|
vvp_mangle_id(ivl_lpm_name(net)), type, width);
|
2001-06-15 06:14:18 +02:00
|
|
|
|
|
|
|
|
draw_lpm_arith_a_b_inputs(net);
|
|
|
|
|
|
2001-06-07 04:12:43 +02:00
|
|
|
fprintf(vvp_out, ";\n");
|
|
|
|
|
}
|
|
|
|
|
|
2001-09-14 06:15:46 +02:00
|
|
|
/*
|
|
|
|
|
* Draw == and != gates. This is done as XNOR functors to compare each
|
|
|
|
|
* pair of bits. The result is combined with a wide and, or a NAND if
|
|
|
|
|
* this is a NE.
|
|
|
|
|
*/
|
|
|
|
|
static void draw_lpm_eq(ivl_lpm_t net)
|
|
|
|
|
{
|
|
|
|
|
unsigned width = ivl_lpm_width(net);
|
|
|
|
|
unsigned idx;
|
|
|
|
|
|
|
|
|
|
const char*and = ivl_lpm_type(net) == IVL_LPM_CMP_NE? "NAND" : "AND";
|
|
|
|
|
|
|
|
|
|
ivl_nexus_t nex;
|
|
|
|
|
|
|
|
|
|
for (idx = 0 ; idx < width ; idx += 1) {
|
|
|
|
|
fprintf(vvp_out, "L_%s/L0C%u .functor XNOR, ",
|
|
|
|
|
vvp_mangle_id(ivl_lpm_name(net)), idx);
|
|
|
|
|
|
|
|
|
|
nex = ivl_lpm_data(net, idx);
|
|
|
|
|
draw_input_from_net(nex);
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out, ", ");
|
|
|
|
|
|
|
|
|
|
nex = ivl_lpm_datab(net, idx);
|
|
|
|
|
draw_input_from_net(nex);
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out, ", C<0>, C<0>;\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (width <= 4) {
|
|
|
|
|
fprintf(vvp_out, "L_%s .functor %s",
|
|
|
|
|
vvp_mangle_id(ivl_lpm_name(net)), and);
|
|
|
|
|
|
|
|
|
|
for (idx = 0 ; idx < width ; idx += 1)
|
|
|
|
|
fprintf(vvp_out, ", L_%s/L0C%u",
|
|
|
|
|
vvp_mangle_id(ivl_lpm_name(net)), idx);
|
|
|
|
|
|
|
|
|
|
for (idx = width ; idx < 4 ; idx += 1)
|
|
|
|
|
fprintf(vvp_out, ", C<1>");
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out, ";\n");
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
unsigned lwidth = width;
|
|
|
|
|
unsigned level = 1;
|
|
|
|
|
unsigned cnt;
|
|
|
|
|
|
|
|
|
|
unsigned bit;
|
|
|
|
|
unsigned first;
|
|
|
|
|
unsigned last;
|
|
|
|
|
|
|
|
|
|
cnt = (lwidth + 3) / 4;
|
|
|
|
|
|
|
|
|
|
while (cnt > 1) {
|
|
|
|
|
for (idx = 0 ; idx < cnt ; idx += 1) {
|
|
|
|
|
first = idx*4;
|
|
|
|
|
last = first + 4;
|
|
|
|
|
if (last > lwidth)
|
|
|
|
|
last = lwidth;
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out, "L_%s/L%uC%u .functor AND",
|
|
|
|
|
vvp_mangle_id(ivl_lpm_name(net)),
|
|
|
|
|
level, idx);
|
|
|
|
|
|
|
|
|
|
for (bit = first ; bit < last ; bit += 1)
|
|
|
|
|
fprintf(vvp_out, ", L_%s/L%uC%u",
|
|
|
|
|
vvp_mangle_id(ivl_lpm_name(net)),
|
|
|
|
|
level-1, bit);
|
|
|
|
|
|
|
|
|
|
for (bit = last ; bit < (idx*4+4) ; bit += 1)
|
|
|
|
|
fprintf(vvp_out, ", C<1>");
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out, ";\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lwidth = cnt;
|
|
|
|
|
level += 1;
|
|
|
|
|
cnt = (lwidth + 3) / 4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out, "L_%s .functor %s",
|
|
|
|
|
vvp_mangle_id(ivl_lpm_name(net)), and);
|
|
|
|
|
|
|
|
|
|
for (idx = 0 ; idx < lwidth ; idx += 1)
|
|
|
|
|
fprintf(vvp_out, ", L_%s/L%uC%u",
|
|
|
|
|
vvp_mangle_id(ivl_lpm_name(net)),
|
|
|
|
|
level-1, idx);
|
|
|
|
|
|
|
|
|
|
for (idx = lwidth ; idx < 4 ; idx += 1)
|
|
|
|
|
fprintf(vvp_out, ", C<1>");
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out, ";\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-26 07:12:02 +02:00
|
|
|
static void draw_lpm_mux(ivl_lpm_t net)
|
|
|
|
|
{
|
|
|
|
|
ivl_nexus_t s;
|
|
|
|
|
unsigned idx, width;
|
|
|
|
|
|
|
|
|
|
/* XXXX Only support A-B muxes for now. */
|
|
|
|
|
assert(ivl_lpm_size(net) == 2);
|
|
|
|
|
assert(ivl_lpm_selects(net) == 1);
|
|
|
|
|
|
|
|
|
|
width = ivl_lpm_width(net);
|
|
|
|
|
s = ivl_lpm_select(net, 0);
|
|
|
|
|
|
|
|
|
|
for (idx = 0 ; idx < width ; idx += 1) {
|
|
|
|
|
ivl_nexus_t a = ivl_lpm_data2(net, 0, idx);
|
|
|
|
|
ivl_nexus_t b = ivl_lpm_data2(net, 1, idx);
|
2001-05-02 06:05:16 +02:00
|
|
|
fprintf(vvp_out, "L_%s/%u .functor MUXZ, ",
|
2001-06-18 05:10:34 +02:00
|
|
|
vvp_mangle_id(ivl_lpm_name(net)), idx);
|
2001-05-06 02:01:02 +02:00
|
|
|
draw_input_from_net(a);
|
2001-04-26 07:12:02 +02:00
|
|
|
fprintf(vvp_out, ", ");
|
2001-05-06 02:01:02 +02:00
|
|
|
draw_input_from_net(b);
|
2001-04-26 07:12:02 +02:00
|
|
|
fprintf(vvp_out, ", ");
|
2001-05-06 02:01:02 +02:00
|
|
|
draw_input_from_net(s);
|
2001-05-02 06:05:16 +02:00
|
|
|
fprintf(vvp_out, ", C<1>;\n");
|
2001-04-26 07:12:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2001-07-06 06:48:04 +02:00
|
|
|
static void draw_lpm_shiftl(ivl_lpm_t net)
|
|
|
|
|
{
|
|
|
|
|
unsigned idx, width, selects;
|
|
|
|
|
|
|
|
|
|
width = ivl_lpm_width(net);
|
|
|
|
|
selects = ivl_lpm_selects(net);
|
2001-07-07 05:01:06 +02:00
|
|
|
|
|
|
|
|
if (ivl_lpm_type(net) == IVL_LPM_SHIFTR)
|
|
|
|
|
fprintf(vvp_out, "L_%s .shift/r %u",
|
|
|
|
|
vvp_mangle_id(ivl_lpm_name(net)), width);
|
|
|
|
|
else
|
|
|
|
|
fprintf(vvp_out, "L_%s .shift/l %u",
|
|
|
|
|
vvp_mangle_id(ivl_lpm_name(net)), width);
|
2001-07-06 06:48:04 +02:00
|
|
|
|
|
|
|
|
for (idx = 0 ; idx < width ; idx += 1) {
|
|
|
|
|
fprintf(vvp_out, ", ");
|
|
|
|
|
draw_input_from_net(ivl_lpm_data(net, idx));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (idx = 0 ; idx < selects ; idx += 1) {
|
|
|
|
|
fprintf(vvp_out, ", ");
|
|
|
|
|
draw_input_from_net(ivl_lpm_select(net, idx));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fprintf(vvp_out, ";\n");
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-26 07:12:02 +02:00
|
|
|
static void draw_lpm_in_scope(ivl_lpm_t net)
|
|
|
|
|
{
|
|
|
|
|
switch (ivl_lpm_type(net)) {
|
2001-06-16 04:41:41 +02:00
|
|
|
|
|
|
|
|
case IVL_LPM_RAM:
|
|
|
|
|
draw_lpm_ram(net);
|
|
|
|
|
return;
|
|
|
|
|
|
2001-06-07 04:12:43 +02:00
|
|
|
case IVL_LPM_ADD:
|
2001-06-07 05:09:37 +02:00
|
|
|
case IVL_LPM_SUB:
|
2001-06-17 01:45:05 +02:00
|
|
|
case IVL_LPM_MULT:
|
2001-10-16 04:19:26 +02:00
|
|
|
case IVL_LPM_DIVIDE:
|
2001-06-07 04:12:43 +02:00
|
|
|
draw_lpm_add(net);
|
|
|
|
|
return;
|
|
|
|
|
|
2001-09-14 06:15:46 +02:00
|
|
|
case IVL_LPM_CMP_EQ:
|
|
|
|
|
case IVL_LPM_CMP_NE:
|
|
|
|
|
draw_lpm_eq(net);
|
|
|
|
|
return;
|
|
|
|
|
|
2001-06-15 06:14:18 +02:00
|
|
|
case IVL_LPM_CMP_GE:
|
|
|
|
|
case IVL_LPM_CMP_GT:
|
|
|
|
|
draw_lpm_cmp(net);
|
|
|
|
|
return;
|
|
|
|
|
|
2001-04-26 07:12:02 +02:00
|
|
|
case IVL_LPM_MUX:
|
|
|
|
|
draw_lpm_mux(net);
|
|
|
|
|
return;
|
|
|
|
|
|
2001-07-06 06:48:04 +02:00
|
|
|
case IVL_LPM_SHIFTL:
|
2001-07-07 05:01:06 +02:00
|
|
|
case IVL_LPM_SHIFTR:
|
2001-07-06 06:48:04 +02:00
|
|
|
draw_lpm_shiftl(net);
|
|
|
|
|
return;
|
|
|
|
|
|
2001-04-26 07:12:02 +02:00
|
|
|
default:
|
|
|
|
|
fprintf(stderr, "XXXX LPM not supported: %s\n",
|
|
|
|
|
ivl_lpm_name(net));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2001-05-09 01:59:33 +02:00
|
|
|
|
|
|
|
|
static void draw_mem_in_scope(ivl_memory_t net)
|
|
|
|
|
{
|
|
|
|
|
int root = ivl_memory_root(net);
|
|
|
|
|
int last = root + ivl_memory_size(net) - 1;
|
|
|
|
|
int msb = ivl_memory_width(net) - 1;
|
|
|
|
|
int lsb = 0;
|
|
|
|
|
fprintf(vvp_out, "M_%s .mem \"%s\", %u,%u, %u,%u;\n",
|
2001-06-18 05:10:34 +02:00
|
|
|
vvp_mangle_id(ivl_memory_name(net)),
|
|
|
|
|
vvp_mangle_name(ivl_memory_basename(net)),
|
2001-05-09 01:59:33 +02:00
|
|
|
msb, lsb, root, last);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-03-21 02:49:43 +01:00
|
|
|
int draw_scope(ivl_scope_t net, ivl_scope_t parent)
|
|
|
|
|
{
|
|
|
|
|
unsigned idx;
|
2001-10-15 04:58:27 +02:00
|
|
|
const char *type;
|
|
|
|
|
switch (ivl_scope_type(net)) {
|
|
|
|
|
case IVL_SCT_MODULE: type = "module"; break;
|
|
|
|
|
case IVL_SCT_FUNCTION: type = "function"; break;
|
|
|
|
|
case IVL_SCT_TASK: type = "task"; break;
|
|
|
|
|
case IVL_SCT_BEGIN: type = "begin"; break;
|
|
|
|
|
case IVL_SCT_FORK: type = "fork"; break;
|
|
|
|
|
default: type = "?"; assert(0);
|
|
|
|
|
}
|
2001-03-21 02:49:43 +01:00
|
|
|
|
2001-10-15 04:58:27 +02:00
|
|
|
fprintf(vvp_out, "S_%s .scope %s, \"%s\"",
|
|
|
|
|
vvp_mangle_id(ivl_scope_name(net)),
|
|
|
|
|
type,
|
|
|
|
|
vvp_mangle_name(ivl_scope_name(net)));
|
2001-06-18 05:10:34 +02:00
|
|
|
if (parent) {
|
|
|
|
|
fprintf(vvp_out, ", S_%s;\n",
|
|
|
|
|
vvp_mangle_id(ivl_scope_name(parent)));
|
|
|
|
|
}
|
2001-03-21 02:49:43 +01:00
|
|
|
else
|
2001-10-15 04:58:27 +02:00
|
|
|
fprintf(vvp_out, ";\n");
|
2001-06-18 05:10:34 +02:00
|
|
|
|
2001-03-25 07:59:46 +02:00
|
|
|
/* Scan the scope for logic devices. For each device, draw out
|
|
|
|
|
a functor that connects pin 0 to the output, and the
|
|
|
|
|
remaining pins to inputs. */
|
|
|
|
|
|
2001-03-25 05:25:43 +02:00
|
|
|
for (idx = 0 ; idx < ivl_scope_logs(net) ; idx += 1) {
|
|
|
|
|
ivl_net_logic_t lptr = ivl_scope_log(net, idx);
|
2001-03-27 08:27:40 +02:00
|
|
|
draw_logic_in_scope(lptr);
|
2001-03-25 05:25:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-03-25 07:59:46 +02:00
|
|
|
/* Scan the signals (reg and net) and draw the appropriate
|
|
|
|
|
statements to make the signal function. */
|
|
|
|
|
|
2001-03-21 02:49:43 +01:00
|
|
|
for (idx = 0 ; idx < ivl_scope_sigs(net) ; idx += 1) {
|
|
|
|
|
ivl_signal_t sig = ivl_scope_sig(net, idx);
|
|
|
|
|
|
2001-03-25 05:25:43 +02:00
|
|
|
switch (ivl_signal_type(sig)) {
|
|
|
|
|
case IVL_SIT_REG:
|
|
|
|
|
draw_reg_in_scope(sig);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
draw_net_in_scope(sig);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2001-03-21 02:49:43 +01:00
|
|
|
}
|
|
|
|
|
|
2001-03-28 08:07:39 +02:00
|
|
|
for (idx = 0 ; idx < ivl_scope_events(net) ; idx += 1) {
|
|
|
|
|
ivl_event_t event = ivl_scope_event(net, idx);
|
|
|
|
|
draw_event_in_scope(event);
|
|
|
|
|
}
|
|
|
|
|
|
2001-05-09 01:59:33 +02:00
|
|
|
for (idx = 0 ; idx < ivl_scope_mems(net) ; idx += 1) {
|
|
|
|
|
ivl_memory_t mem = ivl_scope_mem(net, idx);
|
|
|
|
|
draw_mem_in_scope(mem);
|
|
|
|
|
}
|
|
|
|
|
|
2001-06-16 04:41:41 +02:00
|
|
|
for (idx = 0 ; idx < ivl_scope_lpms(net) ; idx += 1) {
|
|
|
|
|
ivl_lpm_t lpm = ivl_scope_lpm(net, idx);
|
|
|
|
|
draw_lpm_in_scope(lpm);
|
|
|
|
|
}
|
|
|
|
|
|
2001-04-02 04:28:12 +02:00
|
|
|
if (ivl_scope_type(net) == IVL_SCT_TASK)
|
|
|
|
|
draw_task_definition(net);
|
|
|
|
|
|
2001-04-06 04:28:02 +02:00
|
|
|
if (ivl_scope_type(net) == IVL_SCT_FUNCTION)
|
|
|
|
|
draw_func_definition(net);
|
2001-04-02 04:28:12 +02:00
|
|
|
|
2001-03-31 21:29:23 +02:00
|
|
|
ivl_scope_children(net, (ivl_scope_f*) draw_scope, net);
|
2001-03-21 02:49:43 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* $Log: vvp_scope.c,v $
|
2001-10-18 19:30:25 +02:00
|
|
|
* Revision 1.51 2001/10/18 17:30:25 steve
|
|
|
|
|
* Support rnpmos devices. (Philip Blundell)
|
|
|
|
|
*
|
2001-10-16 04:19:26 +02:00
|
|
|
* Revision 1.50 2001/10/16 02:19:27 steve
|
|
|
|
|
* Support IVL_LPM_DIVIDE for structural divide.
|
|
|
|
|
*
|
2001-10-15 04:58:27 +02:00
|
|
|
* Revision 1.49 2001/10/15 02:58:27 steve
|
|
|
|
|
* Carry the type of the scope (Stephan Boettcher)
|
|
|
|
|
*
|
2001-10-09 04:28:44 +02:00
|
|
|
* Revision 1.48 2001/10/09 02:28:44 steve
|
|
|
|
|
* handle nmos and pmos devices.
|
|
|
|
|
*
|
2001-09-15 20:27:04 +02:00
|
|
|
* Revision 1.47 2001/09/15 18:27:04 steve
|
|
|
|
|
* Make configure detect malloc.h
|
|
|
|
|
*
|
2001-09-14 06:15:46 +02:00
|
|
|
* Revision 1.46 2001/09/14 04:15:46 steve
|
|
|
|
|
* Generate code for identity comparators.
|
|
|
|
|
*
|
2001-08-10 02:40:45 +02:00
|
|
|
* Revision 1.45 2001/08/10 00:40:45 steve
|
|
|
|
|
* tgt-vvp generates code that skips nets as inputs.
|
|
|
|
|
*
|
2001-08-03 19:06:10 +02:00
|
|
|
* Revision 1.44 2001/08/03 17:06:10 steve
|
|
|
|
|
* More detailed messages about unsupported things.
|
|
|
|
|
*
|
2001-07-28 05:18:50 +02:00
|
|
|
* Revision 1.43 2001/07/28 03:18:50 steve
|
|
|
|
|
* Generate constant symbols for supply nets.
|
|
|
|
|
*
|
2001-07-22 23:31:14 +02:00
|
|
|
* Revision 1.42 2001/07/22 21:31:14 steve
|
|
|
|
|
* supply signals give input values.
|
|
|
|
|
*
|
2001-07-18 04:44:39 +02:00
|
|
|
* Revision 1.41 2001/07/18 02:44:39 steve
|
|
|
|
|
* Relax driver limit from 64 to forever (Stephan Boettcher)
|
|
|
|
|
*
|
2001-07-16 20:31:49 +02:00
|
|
|
* Revision 1.40 2001/07/16 18:31:49 steve
|
|
|
|
|
* Nest resolvers when there are lots of drivers (Stephan Boettcher)
|
|
|
|
|
*
|
2001-07-09 17:38:35 +02:00
|
|
|
* Revision 1.39 2001/07/09 15:38:35 steve
|
|
|
|
|
* Properly step through wide inputs. (Stephan Boettcher)
|
|
|
|
|
*
|
2001-07-07 05:01:06 +02:00
|
|
|
* Revision 1.38 2001/07/07 03:01:06 steve
|
|
|
|
|
* Generate code for right shift.
|
|
|
|
|
*
|
2001-07-06 06:48:04 +02:00
|
|
|
* Revision 1.37 2001/07/06 04:48:04 steve
|
|
|
|
|
* Generate code for structural left shift.
|
|
|
|
|
*
|
2001-06-19 05:01:10 +02:00
|
|
|
* Revision 1.36 2001/06/19 03:01:10 steve
|
|
|
|
|
* Add structural EEQ gates (Stephan Boettcher)
|
|
|
|
|
*
|
2001-06-18 05:10:34 +02:00
|
|
|
* Revision 1.35 2001/06/18 03:10:34 steve
|
|
|
|
|
* 1. Logic with more than 4 inputs
|
|
|
|
|
* 2. Id and name mangling
|
|
|
|
|
* 3. A memory leak in draw_net_in_scope()
|
|
|
|
|
* (Stephan Boettcher)
|
|
|
|
|
*
|
2001-06-17 01:45:05 +02:00
|
|
|
* Revision 1.34 2001/06/16 23:45:05 steve
|
|
|
|
|
* Add support for structural multiply in t-dll.
|
|
|
|
|
* Add code generators and vvp support for both
|
|
|
|
|
* structural and behavioral multiply.
|
|
|
|
|
*
|
2001-06-16 04:41:41 +02:00
|
|
|
* Revision 1.33 2001/06/16 02:41:42 steve
|
|
|
|
|
* Generate code to support memory access in continuous
|
|
|
|
|
* assignment statements. (Stephan Boettcher)
|
|
|
|
|
*
|
2001-06-15 06:14:18 +02:00
|
|
|
* Revision 1.32 2001/06/15 04:14:19 steve
|
|
|
|
|
* Generate vvp code for GT and GE comparisons.
|
|
|
|
|
*
|
2001-06-07 06:20:10 +02:00
|
|
|
* Revision 1.31 2001/06/07 04:20:10 steve
|
2001-03-21 02:49:43 +01:00
|
|
|
*/
|
|
|
|
|
|