Merge branch 'master' of ssh://steve-icarus@icarus.com/home/u/icarus/steve/git/verilog

This commit is contained in:
Stephen Williams 2008-01-07 16:26:17 -08:00
commit ca50991eeb
50 changed files with 505 additions and 302 deletions

View File

@ -23,8 +23,9 @@
# include "config.h" # include "config.h"
# include "HName.h" # include "HName.h"
# include <iostream> # include <iostream>
# include <string.h> # include <cstring>
# include <stdlib.h> # include <cstdlib>
# include <climits>
#ifdef HAVE_MALLOC_H #ifdef HAVE_MALLOC_H
# include <malloc.h> # include <malloc.h>
#endif #endif

View File

@ -27,8 +27,9 @@ PWire::PWire(const pform_name_t&n,
NetNet::PortType pt, NetNet::PortType pt,
ivl_variable_type_t dt) ivl_variable_type_t dt)
: hname_(n), type_(t), port_type_(pt), data_type_(dt), : hname_(n), type_(t), port_type_(pt), data_type_(dt),
signed_(false), isint_(false), port_set_(false), net_set_(false), signed_(false), isint_(false),
port_msb_(0), port_lsb_(0), net_msb_(0), net_lsb_(0), error_cnt_(0), port_msb_(0), port_lsb_(0), port_set_(false),
net_msb_(0), net_lsb_(0), net_set_(false), error_cnt_(0),
lidx_(0), ridx_(0) lidx_(0), ridx_(0)
{ {
if (t == NetNet::INTEGER) { if (t == NetNet::INTEGER) {
@ -113,6 +114,11 @@ bool PWire::set_data_type(ivl_variable_type_t dt)
return true; return true;
} }
ivl_variable_type_t PWire::get_data_type() const
{
return data_type_;
}
void PWire::set_signed(bool flag) void PWire::set_signed(bool flag)
{ {
signed_ = flag; signed_ = flag;

View File

@ -19,6 +19,7 @@
# include "config.h" # include "config.h"
# include <cstdlib>
# include "netlist.h" # include "netlist.h"
# include "netmisc.h" # include "netmisc.h"
# include "functor.h" # include "functor.h"

View File

@ -1,4 +1,6 @@
%option nounput
%{ %{
/* /*
* Copyright (c) 2001 Stephen Williams (steve@icarus.com) * Copyright (c) 2001 Stephen Williams (steve@icarus.com)

View File

@ -18,6 +18,9 @@
*/ */
# include "config.h" # include "config.h"
# include <typeinfo>
# include <cstdlib>
# include <cstring>
# include "compiler.h" # include "compiler.h"
# include "pform.h" # include "pform.h"

View File

@ -23,6 +23,7 @@
# include "netlist.h" # include "netlist.h"
# include "netmisc.h" # include "netmisc.h"
# include "compiler.h" # include "compiler.h"
# include <cstdlib>
# include <iostream> # include <iostream>
# include "ivl_assert.h" # include "ivl_assert.h"

View File

@ -24,6 +24,8 @@
# include "netmisc.h" # include "netmisc.h"
# include "compiler.h" # include "compiler.h"
# include <cstdlib>
# include <cstring>
# include <iostream> # include <iostream>
# include "ivl_assert.h" # include "ivl_assert.h"
@ -2274,7 +2276,7 @@ bool PEIdent::eval_part_select_(Design*des, NetScope*scope, NetNet*sig,
case index_component_t::SEL_PART: { case index_component_t::SEL_PART: {
long msb, lsb; long msb, lsb;
bool flag = calculate_parts_(des, scope, msb, lsb); /* bool flag = */ calculate_parts_(des, scope, msb, lsb);
lidx = sig->sb_to_idx(lsb); lidx = sig->sb_to_idx(lsb);
midx = sig->sb_to_idx(msb); midx = sig->sb_to_idx(msb);

View File

@ -24,6 +24,7 @@
# include "util.h" # include "util.h"
# include "netmisc.h" # include "netmisc.h"
# include <cstdlib>
# include <iostream> # include <iostream>
# include "ivl_assert.h" # include "ivl_assert.h"

View File

@ -20,6 +20,7 @@
# include "config.h" # include "config.h"
# include "compiler.h" # include "compiler.h"
# include "netmisc.h" # include "netmisc.h"
# include <cstring>
# include <iostream> # include <iostream>
# include <stdio.h> # include <stdio.h>

View File

@ -19,6 +19,7 @@
# include "config.h" # include "config.h"
# include <cstdlib>
# include <iostream> # include <iostream>
# include "Module.h" # include "Module.h"

View File

@ -30,6 +30,7 @@
*/ */
# include <typeinfo> # include <typeinfo>
# include <cstdlib>
# include <sstream> # include <sstream>
# include <list> # include <list>
# include "pform.h" # include "pform.h"

View File

@ -29,6 +29,7 @@
# include "netlist.h" # include "netlist.h"
# include <typeinfo> # include <typeinfo>
# include <cassert> # include <cassert>
# include <cstring>
bool NetNode::emit_node(struct target_t*tgt) const bool NetNode::emit_node(struct target_t*tgt) const
{ {

View File

@ -19,6 +19,7 @@
# include "config.h" # include "config.h"
# include <cstring>
# include <iostream> # include <iostream>
# include "PExpr.h" # include "PExpr.h"

View File

@ -21,6 +21,7 @@
# include "compiler.h" # include "compiler.h"
# include <iostream> # include <iostream>
# include <cstdlib>
# include "netlist.h" # include "netlist.h"
# include "ivl_assert.h" # include "ivl_assert.h"

View File

@ -58,7 +58,7 @@ ivlpp@EXEEXT@: $O
$(CC) $(LDFLAGS) $O -o ivlpp@EXEEXT@ @EXTRALIBS@ $(CC) $(LDFLAGS) $O -o ivlpp@EXEEXT@ @EXTRALIBS@
lexor.c: lexor.lex lexor.c: lexor.lex
flex -s -olexor.c $(srcdir)/lexor.lex flex -olexor.c $(srcdir)/lexor.lex
parse.h parse.c: parse.y parse.h parse.c: parse.y
bison --verbose -t -d -o parse.c $(srcdir)/parse.y bison --verbose -t -d -o parse.c $(srcdir)/parse.y

View File

@ -158,6 +158,8 @@ static int ma_parenthesis_level = 0;
%} %}
%option stack %option stack
%option nounput
%option noyy_top_state
%x PPINCLUDE %x PPINCLUDE
%x DEF_NAME %x DEF_NAME

View File

@ -25,6 +25,8 @@
# include <stdio.h> # include <stdio.h>
static void yyerror(const char*msg); static void yyerror(const char*msg);
extern int yylex (void);
%} %}
%% %%

View File

@ -1,5 +1,6 @@
%option never-interactive %option never-interactive
%option nounput
%{ %{
/* /*
@ -390,8 +391,9 @@ W [ \t\b\f\r]+
error_count += 1; } error_count += 1; }
/* Final catchall. something got lost or mishandled. */ /* Final catchall. something got lost or mishandled. */
/* XXX Should we tell the luser something about the lexical state? */
. { cerr << yylloc.text << ":" << yylloc.first_line <*>.|\n { cerr << yylloc.text << ":" << yylloc.first_line
<< ": error: unmatched character ("; << ": error: unmatched character (";
if (isgraph(yytext[0])) if (isgraph(yytext[0]))
cerr << yytext[0]; cerr << yytext[0];

View File

@ -26,6 +26,8 @@
# include "compiler.h" # include "compiler.h"
# include <iostream> # include <iostream>
# include <map> # include <map>
# include <cstdlib>
# include <cstring>
# include <string> # include <string>
# include <sys/types.h> # include <sys/types.h>
# include <dirent.h> # include <dirent.h>

View File

@ -44,6 +44,7 @@ const char NOTICE[] =
# include <iostream> # include <iostream>
# include <fstream> # include <fstream>
# include <queue> # include <queue>
# include <cstring>
# include <list> # include <list>
# include <map> # include <map>
# include <unistd.h> # include <unistd.h>

View File

@ -26,6 +26,7 @@
# include "netlist.h" # include "netlist.h"
# include <sstream> # include <sstream>
# include <cstring>
# include <string> # include <string>
# include <typeinfo> # include <typeinfo>
#ifdef HAVE_MALLOC_H #ifdef HAVE_MALLOC_H

View File

@ -24,6 +24,7 @@
# include "compiler.h" # include "compiler.h"
# include "netlist.h" # include "netlist.h"
# include <cstring>
# include <sstream> # include <sstream>
/* /*

View File

@ -22,6 +22,7 @@
# include <iostream> # include <iostream>
# include <typeinfo> # include <typeinfo>
# include <cstdlib>
# include "compiler.h" # include "compiler.h"
# include "netlist.h" # include "netlist.h"
# include "netmisc.h" # include "netmisc.h"

View File

@ -19,6 +19,7 @@
# include "config.h" # include "config.h"
# include <cstdlib>
# include "netlist.h" # include "netlist.h"
# include "netmisc.h" # include "netmisc.h"
# include "PExpr.h" # include "PExpr.h"

View File

@ -26,6 +26,7 @@
# include "pform.h" # include "pform.h"
# include "Statement.h" # include "Statement.h"
# include "PSpec.h" # include "PSpec.h"
# include <cstring>
# include <sstream> # include <sstream>
class PSpecPath; class PSpecPath;

View File

@ -33,6 +33,10 @@
# include <stack> # include <stack>
# include <typeinfo> # include <typeinfo>
# include <sstream> # include <sstream>
# include <cstring>
# include <cstdlib>
# include "ivl_assert.h"
map<perm_string,Module*> pform_modules; map<perm_string,Module*> pform_modules;
map<perm_string,PUdp*> pform_primitives; map<perm_string,PUdp*> pform_primitives;
@ -1313,9 +1317,17 @@ void pform_makewire(const vlltype&li, const char*nm,
FILE_NAME(cur, li.text, li.first_line); FILE_NAME(cur, li.text, li.first_line);
bool flag;
switch (dt) { switch (dt) {
case IVL_VT_REAL: case IVL_VT_REAL:
cur->set_data_type(dt); flag = cur->set_data_type(dt);
if (flag == false) {
cerr << cur->get_fileline() << ": internal error: "
<< " wire data type handling mismatch. Cannot change "
<< cur->get_data_type()
<< " to " << dt << "." << endl;
}
ivl_assert(*cur, flag);
cur->set_range(0, 0, SR_NET); cur->set_range(0, 0, SR_NET);
cur->set_signed(true); cur->set_signed(true);
break; break;
@ -1417,7 +1429,7 @@ void pform_set_port_type(perm_string nm, NetNet::PortType pt,
pform_name_t name = hier_name(nm); pform_name_t name = hier_name(nm);
PWire*cur = pform_cur_module->get_wire(name); PWire*cur = pform_cur_module->get_wire(name);
if (cur == 0) { if (cur == 0) {
cur = new PWire(name, NetNet::IMPLICIT, NetNet::PIMPLICIT, IVL_VT_LOGIC); cur = new PWire(name, NetNet::IMPLICIT, NetNet::PIMPLICIT, IVL_VT_NO_TYPE);
FILE_NAME(cur, file, lineno); FILE_NAME(cur, file, lineno);
pform_cur_module->add_wire(cur); pform_cur_module->add_wire(cur);
} }

View File

@ -23,6 +23,8 @@
# include "config.h" # include "config.h"
# include "compiler.h" # include "compiler.h"
# include <stdio.h> # include <stdio.h>
# include <cstring>
# include <cstdlib>
/* /*
* Manage the information about system functions. This information is * Manage the information about system functions. This information is

View File

@ -21,6 +21,7 @@
# include <iostream> # include <iostream>
# include <cstring>
# include "t-dll.h" # include "t-dll.h"
# include "netlist.h" # include "netlist.h"
# include <assert.h> # include <assert.h>

View File

@ -25,6 +25,7 @@
# include <iostream> # include <iostream>
# include <cstring>
# include "target.h" # include "target.h"
# include "ivl_target.h" # include "ivl_target.h"
# include "compiler.h" # include "compiler.h"

View File

@ -21,6 +21,7 @@
# include <iostream> # include <iostream>
# include <cstring>
# include <stdio.h> // sprintf() # include <stdio.h> // sprintf()
# include "compiler.h" # include "compiler.h"
# include "t-dll.h" # include "t-dll.h"

View File

@ -731,8 +731,8 @@ static struct vector_info draw_binary_expr_le(ivl_expr_t exp,
assert(ivl_expr_value(re) == IVL_VT_LOGIC assert(ivl_expr_value(re) == IVL_VT_LOGIC
|| ivl_expr_value(re) == IVL_VT_BOOL); || ivl_expr_value(re) == IVL_VT_BOOL);
lv.wid = 0; lv.wid = 0; lv.base=0;
rv.wid = 0; rv.wid = 0; rv.base=0;
switch (ivl_expr_opcode(exp)) { switch (ivl_expr_opcode(exp)) {
case 'G': case 'G':

View File

@ -1613,7 +1613,10 @@ static void draw_lpm_add(ivl_lpm_t net)
switch (ivl_lpm_type(net)) { switch (ivl_lpm_type(net)) {
case IVL_LPM_ADD: case IVL_LPM_ADD:
type = "sum"; if (dto == IVL_VT_REAL)
type = "sum.r";
else
type = "sum";
break; break;
case IVL_LPM_SUB: case IVL_LPM_SUB:
if (dto == IVL_VT_REAL) if (dto == IVL_VT_REAL)
@ -1622,7 +1625,10 @@ static void draw_lpm_add(ivl_lpm_t net)
type = "sub"; type = "sub";
break; break;
case IVL_LPM_MULT: case IVL_LPM_MULT:
type = "mult"; if (dto == IVL_VT_REAL)
type = "mult.r";
else
type = "mult";
break; break;
case IVL_LPM_DIVIDE: case IVL_LPM_DIVIDE:
if (dto == IVL_VT_REAL) if (dto == IVL_VT_REAL)
@ -1633,7 +1639,10 @@ static void draw_lpm_add(ivl_lpm_t net)
type = "div"; type = "div";
break; break;
case IVL_LPM_MOD: case IVL_LPM_MOD:
type = "mod"; if (dto == IVL_VT_REAL)
assert(0); /* Not supported for reals, */
else
type = "mod";
break; break;
default: default:
assert(0); assert(0);

View File

@ -29,6 +29,7 @@
# include <iostream> # include <iostream>
# include <math.h> # include <math.h>
# include <assert.h> # include <assert.h>
# include <cstring>
verireal::verireal() verireal::verireal()
{ {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003-2004 Tony Bybell. * Copyright (c) 2003-2007 Tony Bybell.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@ -20,6 +20,11 @@
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
*/ */
#ifdef _AIX
#pragma alloca
#endif
#include <config.h>
#include "lxt2_write.h" #include "lxt2_write.h"
@ -50,6 +55,55 @@ for(;;s++)
} }
/*
* in-place sort to keep chained facs from migrating...
*/
static void wave_mergesort(struct lxt2_wr_symbol **a, struct lxt2_wr_symbol **b, int lo, int hi)
{
int i, j, k;
if (lo<hi)
{
int mid=(lo+hi)/2;
wave_mergesort(a, b, lo, mid);
wave_mergesort(a, b, mid+1, hi);
i=0; j=lo;
while (j<=mid)
{
b[i++]=a[j++];
}
i=0; k=lo;
while ((k<j)&&(j<=hi))
{
if (strcmp(b[i]->name, a[j]->name) <= 0)
{
a[k++]=b[i++];
}
else
{
a[k++]=a[j++];
}
}
while (k<j)
{
a[k++]=b[i++];
}
}
}
static void wave_msort(struct lxt2_wr_symbol **a, int num)
{
struct lxt2_wr_symbol **b = malloc(((num/2)+1) * sizeof(struct lxt2_wr_symbol *));
wave_mergesort(a, b, 0, num-1);
free(b);
}
/************************ splay ************************/ /************************ splay ************************/
static lxt2_wr_ds_Tree * lxt2_wr_ds_splay (granmsk_t i, lxt2_wr_ds_Tree * t) { static lxt2_wr_ds_Tree * lxt2_wr_ds_splay (granmsk_t i, lxt2_wr_ds_Tree * t) {
@ -497,21 +551,6 @@ strcpy(lt->compress_fac_str, str);
* emit facs in sorted order along with geometry * emit facs in sorted order along with geometry
* and sync table info * and sync table info
*/ */
static int lxt2_wr_compare(const void *v1, const void *v2)
{
struct lxt2_wr_symbol *s1 = *(struct lxt2_wr_symbol **)v1;
struct lxt2_wr_symbol *s2 = *(struct lxt2_wr_symbol **)v2;
int rc = strcmp(s1->name, s2->name);
if(rc)
{
return(rc);
}
else
{
return(s1->msb - s2->msb);
}
}
static void strip_brack(struct lxt2_wr_symbol *s) static void strip_brack(struct lxt2_wr_symbol *s)
{ {
@ -521,6 +560,11 @@ if(s->namlen<3) return;
lastch--; lastch--;
while(lastch!=s->name) while(lastch!=s->name)
{ {
if(*lastch=='.')
{
return; /* MTI SV [0.3] notation for implicit vars */
}
if(*lastch=='[') if(*lastch=='[')
{ {
*lastch=0x00; *lastch=0x00;
@ -539,7 +583,7 @@ int i;
if((lt)&&(lt->numfacs)) if((lt)&&(lt->numfacs))
{ {
struct lxt2_wr_symbol *s = lt->symchain; struct lxt2_wr_symbol *s = lt->symchain;
struct lxt2_wr_symbol **aliascache = calloc(lt->numalias, sizeof(struct lxt2_wr_symbol *)); struct lxt2_wr_symbol **aliascache = calloc(lt->numalias ? lt->numalias : 1, sizeof(struct lxt2_wr_symbol *));
int aliases_encountered, facs_encountered; int aliases_encountered, facs_encountered;
lt->sorted_facs = (struct lxt2_wr_symbol **)calloc(lt->numfacs, sizeof(struct lxt2_wr_symbol *)); lt->sorted_facs = (struct lxt2_wr_symbol **)calloc(lt->numfacs, sizeof(struct lxt2_wr_symbol *));
@ -549,17 +593,17 @@ if((lt)&&(lt->numfacs))
if(lt->do_strip_brackets) if(lt->do_strip_brackets)
for(i=0;i<lt->numfacs;i++) for(i=0;i<lt->numfacs;i++)
{ {
lt->sorted_facs[i] = s; lt->sorted_facs[lt->numfacs - i - 1] = s; /* facs were chained backwards so reverse to restore bitslicing */
strip_brack(s); strip_brack(s);
s=s->symchain; s=s->symchain;
} }
else else
for(i=0;i<lt->numfacs;i++) for(i=0;i<lt->numfacs;i++)
{ {
lt->sorted_facs[i] = s; lt->sorted_facs[lt->numfacs - i - 1] = s; /* facs were chained backwards so reverse to restore bitslicing */
s=s->symchain; s=s->symchain;
} }
qsort((void *)lt->sorted_facs, lt->numfacs, sizeof(struct lxt2_wr_symbol *), lxt2_wr_compare); wave_msort(lt->sorted_facs, lt->numfacs);
if(lt->partial_preference) if(lt->partial_preference)
{ {
@ -690,7 +734,7 @@ if((lt)&&(lt->numfacs))
/* /*
* initialize the trace and get back and lt context * initialize the trace and get back an lt context
*/ */
struct lxt2_wr_trace *lxt2_wr_init(const char *name) struct lxt2_wr_trace *lxt2_wr_init(const char *name)
{ {
@ -1005,8 +1049,10 @@ for(cnt = 0; cnt < lt->break_header_size; cnt += sizeof(buf))
seg = sizeof(buf); seg = sizeof(buf);
} }
fread(buf, seg, 1, clone); if(fread(buf, seg, 1, clone))
fwrite(buf, seg, 1, f2); {
if(!fwrite(buf, seg, 1, f2)) break; /* write error! */
}
} }
fclose(clone); fclose(clone);
@ -1380,7 +1426,7 @@ if((lt->timegranule>=lt->maxgranule)||(do_finalize)||(early_flush))
lxt2_wr_emit_u64(lt, (lt->firsttime>>32)&0xffffffff, lt->firsttime&0xffffffff); lxt2_wr_emit_u64(lt, (lt->firsttime>>32)&0xffffffff, lt->firsttime&0xffffffff);
lxt2_wr_emit_u64(lt, (lt->lasttime>>32)&0xffffffff, lt->lasttime&0xffffffff); lxt2_wr_emit_u64(lt, (lt->lasttime>>32)&0xffffffff, lt->lasttime&0xffffffff);
/* fprintf(stderr, "start: %Ld, end %Ld\n", lt->firsttime, lt->lasttime); */ /* fprintf(stderr, "start: %lld, end %lld\n", lt->firsttime, lt->lasttime); */
lt->timegranule=0; lt->timegranule=0;
lt->numblock++; lt->numblock++;
@ -1466,9 +1512,10 @@ if(lt)
} }
else if (s->flags&LXT2_WR_SYM_F_DOUBLE) else if (s->flags&LXT2_WR_SYM_F_DOUBLE)
{ {
double value; double value = 0;
sscanf(s->value, "%lg", &value); sscanf(s->value, "%lg", &value);
errno = 0;
lxt2_wr_emit_value_double(lt, s, 0, value); lxt2_wr_emit_value_double(lt, s, 0, value);
} }
else if (s->flags&LXT2_WR_SYM_F_STRING) else if (s->flags&LXT2_WR_SYM_F_STRING)
@ -1752,13 +1799,13 @@ while(s->aliased_to) /* find root alias if exists */
valuelen = strlen(value); /* ensure string is proper length */ valuelen = strlen(value); /* ensure string is proper length */
if(valuelen == s->len) if(valuelen == s->len)
{ {
vfix = alloca(s->len+1); vfix = wave_alloca(s->len+1);
strcpy(vfix, value); strcpy(vfix, value);
value = vfix; value = vfix;
} }
else else
{ {
vfix = alloca(s->len+1); vfix = wave_alloca(s->len+1);
if(valuelen < s->len) if(valuelen < s->len)
{ {
@ -1972,16 +2019,19 @@ if((lt)&&(!lt->blackout))
s = lt->symchain; s = lt->symchain;
while(s) while(s)
{ {
if((s->msk & (LXT2_WR_GRAN_1VAL<<lt->timepos)) == LXT2_WR_GRAN_0VAL) if(!(s->flags&LXT2_WR_SYM_F_ALIAS))
{ {
s->msk |= (LXT2_WR_GRAN_1VAL<<lt->timepos); if((s->msk & (LXT2_WR_GRAN_1VAL<<lt->timepos)) == LXT2_WR_GRAN_0VAL)
s->chg[s->chgpos] = LXT2_WR_ENC_BLACKOUT; {
s->msk |= (LXT2_WR_GRAN_1VAL<<lt->timepos);
s->chg[s->chgpos] = LXT2_WR_ENC_BLACKOUT;
s->chgpos++; s->chgpos++;
} }
else else
{ {
s->chg[s->chgpos-1] = LXT2_WR_ENC_BLACKOUT; s->chg[s->chgpos-1] = LXT2_WR_ENC_BLACKOUT;
}
} }
s=s->symchain; s=s->symchain;
@ -2006,26 +2056,29 @@ if((lt)&&(lt->blackout))
s = lt->symchain; s = lt->symchain;
while(s) while(s)
{ {
if(s->flags&LXT2_WR_SYM_F_DOUBLE) if(!(s->flags&LXT2_WR_SYM_F_ALIAS))
{ {
free(s->value); if(s->flags&LXT2_WR_SYM_F_DOUBLE)
s->value = strdup("0"); /* will cause mismatch then flush */ {
}
else
{
if(!(s->flags&LXT2_WR_SYM_F_STRING))
{
s->value[0] = '-'; /* will cause mismatch then flush */
for(i=1;i<s->len;i++)
{
s->value[i] = 'x'; /* initial value */
}
s->value[i]=0;
}
else
{
free(s->value); free(s->value);
s->value = calloc(1, 1*sizeof(char)); s->value = strdup("0"); /* will cause mismatch then flush */
}
else
{
if(!(s->flags&LXT2_WR_SYM_F_STRING))
{
s->value[0] = '-'; /* will cause mismatch then flush */
for(i=1;i<s->len;i++)
{
s->value[i] = 'x'; /* initial value */
}
s->value[i]=0;
}
else
{
free(s->value);
s->value = calloc(1, 1*sizeof(char));
}
} }
} }
@ -2107,6 +2160,7 @@ if(lt)
lt->symchain=NULL; lt->symchain=NULL;
} }
free(lt->lxtname);
free(lt->sorted_facs); free(lt->sorted_facs);
fclose(lt->handle); fclose(lt->handle);
free(lt); free(lt);

View File

@ -37,6 +37,7 @@
#define ftello ftell #define ftello ftell
#endif #endif
#define wave_alloca alloca
#define LXT2_WR_HDRID (0x1380) #define LXT2_WR_HDRID (0x1380)
#define LXT2_WR_VERSION (0x0001) #define LXT2_WR_VERSION (0x0001)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001-3 Tony Bybell. * Copyright (c) 2001-7 Tony Bybell.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@ -20,8 +20,58 @@
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
*/ */
#include <config.h>
#include "lxt_write.h" #include "lxt_write.h"
/*
* in-place sort to keep chained facs from migrating...
*/
static void wave_mergesort(struct lt_symbol **a, struct lt_symbol **b, int lo, int hi)
{
int i, j, k;
if (lo<hi)
{
int mid=(lo+hi)/2;
wave_mergesort(a, b, lo, mid);
wave_mergesort(a, b, mid+1, hi);
i=0; j=lo;
while (j<=mid)
{
b[i++]=a[j++];
}
i=0; k=lo;
while ((k<j)&&(j<=hi))
{
if (strcmp(b[i]->name, a[j]->name) <= 0)
{
a[k++]=b[i++];
}
else
{
a[k++]=a[j++];
}
}
while (k<j)
{
a[k++]=b[i++];
}
}
}
static void wave_msort(struct lt_symbol **a, int num)
{
struct lt_symbol **b = malloc(((num/2)+1) * sizeof(struct lt_symbol *));
wave_mergesort(a, b, 0, num-1);
free(b);
}
/************************ splay ************************/ /************************ splay ************************/
static int dslxt_success; static int dslxt_success;
@ -561,26 +611,6 @@ strcpy(lt->compress_fac_str, str);
} }
/*
* emit facs in sorted order along with geometry
* and sync table info
*/
static int lt_compare(const void *v1, const void *v2)
{
struct lt_symbol *s1 = *(struct lt_symbol **)v1;
struct lt_symbol *s2 = *(struct lt_symbol **)v2;
int rc = strcmp(s1->name, s2->name);
if(rc)
{
return(rc);
}
else
{
return(s1->msb - s2->msb);
}
}
static void strip_brack(struct lt_symbol *s) static void strip_brack(struct lt_symbol *s)
{ {
char *lastch = s->name+s->namlen - 1; char *lastch = s->name+s->namlen - 1;
@ -589,6 +619,11 @@ if(s->namlen<3) return;
lastch--; lastch--;
while(lastch!=s->name) while(lastch!=s->name)
{ {
if(*lastch=='.')
{
return; /* MTI SV [0.3] notation for implicit vars */
}
if(*lastch=='[') if(*lastch=='[')
{ {
*lastch=0x00; *lastch=0x00;
@ -616,17 +651,17 @@ if((lt)&&(lt->numfacs))
if(lt->do_strip_brackets) if(lt->do_strip_brackets)
for(i=0;i<lt->numfacs;i++) for(i=0;i<lt->numfacs;i++)
{ {
lt->sorted_facs[i] = s; lt->sorted_facs[lt->numfacs - i - 1] = s; /* facs were chained backwards so reverse to restore bitslicing */
strip_brack(s); strip_brack(s);
s=s->symchain; s=s->symchain;
} }
else else
for(i=0;i<lt->numfacs;i++) for(i=0;i<lt->numfacs;i++)
{ {
lt->sorted_facs[i] = s; lt->sorted_facs[lt->numfacs - i - 1] = s; /* facs were chained backwards so reverse to restore bitslicing*/
s=s->symchain; s=s->symchain;
} }
qsort((void *)lt->sorted_facs, lt->numfacs, sizeof(struct lt_symbol *), lt_compare); wave_msort(lt->sorted_facs, lt->numfacs);
for(i=0;i<lt->numfacs;i++) for(i=0;i<lt->numfacs;i++)
{ {
@ -831,7 +866,7 @@ switch(numbytes_trans&3)
case 3: lt->lt_emit_u32(lt, numtrans); break; case 3: lt->lt_emit_u32(lt, numtrans); break;
} }
/* printf("Clock finish for '%s' at %Ld ending with '%c' for %d repeats over a switch delta of %d\n", /* printf("Clock finish for '%s' at %lld ending with '%c' for %d repeats over a switch delta of %d\n",
s->name, lt->timeval, s->clk_prevval, s->clk_numtrans - LT_CLKPACK, s->clk_delta); */ s->name, lt->timeval, s->clk_prevval, s->clk_numtrans - LT_CLKPACK, s->clk_delta); */
s->clk_prevtrans = ULLDescriptor(~0); s->clk_prevtrans = ULLDescriptor(~0);
s->clk_numtrans = 0; s->clk_numtrans = 0;
@ -932,7 +967,7 @@ switch(numbytes_trans&3)
case 3: lt->lt_emit_u32(lt, numtrans); break; case 3: lt->lt_emit_u32(lt, numtrans); break;
} }
/* printf("Clock finish for '%s' at %Ld ending with '%08x' for %d repeats over a switch delta of %Ld\n", /* printf("Clock finish for '%s' at %lld ending with '%08x' for %d repeats over a switch delta of %lld\n",
s->name, lt->timeval, s->clk_prevval, s->clk_numtrans - LT_CLKPACK_M, s->clk_delta); */ s->name, lt->timeval, s->clk_prevval, s->clk_numtrans - LT_CLKPACK_M, s->clk_delta); */
s->clk_prevtrans = ULLDescriptor(~0); s->clk_prevtrans = ULLDescriptor(~0);
s->clk_numtrans = 0; s->clk_numtrans = 0;
@ -1467,17 +1502,17 @@ if((lt)&&(!lt->emitted)&&(!lt->sorted_facs))
if(lt->do_strip_brackets) if(lt->do_strip_brackets)
for(i=0;i<lt->numfacs;i++) for(i=0;i<lt->numfacs;i++)
{ {
lt->sorted_facs[i] = s; lt->sorted_facs[lt->numfacs - i - 1] = s; /* facs were chained backwards so reverse to restore bitslicing */
strip_brack(s); strip_brack(s);
s=s->symchain; s=s->symchain;
} }
else else
for(i=0;i<lt->numfacs;i++) for(i=0;i<lt->numfacs;i++)
{ {
lt->sorted_facs[i] = s; lt->sorted_facs[lt->numfacs - i - 1] = s; /* facs were chained backwards so reverse to restore bitslicing */
s=s->symchain; s=s->symchain;
} }
qsort((void *)lt->sorted_facs, lt->numfacs, sizeof(struct lt_symbol *), lt_compare); wave_msort(lt->sorted_facs, lt->numfacs);
for(i=0;i<lt->numfacs;i++) for(i=0;i<lt->numfacs;i++)
{ {
@ -1639,6 +1674,7 @@ if(!(s->flags&(LT_SYM_F_DOUBLE|LT_SYM_F_STRING)))
unsigned int last_change_delta; unsigned int last_change_delta;
if((lt->clock_compress)&&(s->rows==0)) if((lt->clock_compress)&&(s->rows==0))
{
if((len>1)&&(len<=32)) if((len>1)&&(len<=32))
{ {
int ivalue = value; int ivalue = value;
@ -1678,7 +1714,7 @@ if(!(s->flags&(LT_SYM_F_DOUBLE|LT_SYM_F_STRING)))
s->clk_prevval1 = s->clk_prevval; s->clk_prevval1 = s->clk_prevval;
s->clk_prevval = ivalue; s->clk_prevval = ivalue;
/* printf("Clock value '%08x' for '%s' at %Ld (#%d)\n", ivalue, s->name, lt->timeval, s->clk_numtrans); */ /* printf("Clock value '%08x' for '%s' at %lld (#%d)\n", ivalue, s->name, lt->timeval, s->clk_numtrans); */
return(1); return(1);
} }
} }
@ -1779,6 +1815,7 @@ if(!(s->flags&(LT_SYM_F_DOUBLE|LT_SYM_F_STRING)))
s->clk_prevval = ivalue + '0'; s->clk_prevval = ivalue + '0';
} }
}
/* normal trace handling */ /* normal trace handling */
@ -2120,7 +2157,7 @@ if((s->flags)&LT_SYM_F_STRING)
int numbytes; /* number of bytes to store value minus one */ int numbytes; /* number of bytes to store value minus one */
unsigned int last_change_delta = lt->position - s->last_change - 2; unsigned int last_change_delta = lt->position - s->last_change - 2;
if(lt->numfacs_bytes) if(!lt->numfacs_bytes)
{ {
if(last_change_delta >= 256*65536) if(last_change_delta >= 256*65536)
{ {
@ -2245,6 +2282,7 @@ if(!(s->flags&(LT_SYM_F_DOUBLE|LT_SYM_F_STRING)))
int len = ((s->flags)&LT_SYM_F_INTEGER) ? 32 : s->len; int len = ((s->flags)&LT_SYM_F_INTEGER) ? 32 : s->len;
if((lt->clock_compress)&&(s->rows==0)) if((lt->clock_compress)&&(s->rows==0))
{
if((len>1)&&(len<=32)) if((len>1)&&(len<=32))
{ {
int legal = 0; int legal = 0;
@ -2308,7 +2346,7 @@ if(!(s->flags&(LT_SYM_F_DOUBLE|LT_SYM_F_STRING)))
s->clk_prevval1 = s->clk_prevval; s->clk_prevval1 = s->clk_prevval;
s->clk_prevval = ivalue; s->clk_prevval = ivalue;
/* printf("Clock value '%08x' for '%s' [len=%d] at %Ld (#%d)\n", /* printf("Clock value '%08x' for '%s' [len=%d] at %lld (#%d)\n",
ivalue, s->name, len, lt->timeval, s->clk_numtrans); */ ivalue, s->name, len, lt->timeval, s->clk_numtrans); */
return(1); return(1);
} }
@ -2374,7 +2412,7 @@ if(!(s->flags&(LT_SYM_F_DOUBLE|LT_SYM_F_STRING)))
{ {
s->clk_prevval = value[0]; s->clk_prevval = value[0];
/* printf("Clock value '%c' for '%s' at %Ld (#%d)\n", value[0], s->name, lt->timeval, s->clk_numtrans); */ /* printf("Clock value '%c' for '%s' at %lld (#%d)\n", value[0], s->name, lt->timeval, s->clk_numtrans); */
return(1); return(1);
} }
} }
@ -2408,6 +2446,7 @@ if(!(s->flags&(LT_SYM_F_DOUBLE|LT_SYM_F_STRING)))
s->clk_prevval = value[0]; s->clk_prevval = value[0];
} }
}
/* normal trace handling */ /* normal trace handling */

View File

@ -1,5 +1,6 @@
%option never-interactive %option never-interactive
%option nounput
%{ %{
/* /*

View File

@ -1,4 +1,6 @@
%option nounput
%{ %{
/* /*
* Copyright (c) 1999 Stephen Williams (steve@icarus.com) * Copyright (c) 1999 Stephen Williams (steve@icarus.com)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001-2005 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -16,9 +16,6 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT
#ident "$Id: arith.cc,v 1.50 2007/01/20 02:09:54 steve Exp $"
#endif
# include "arith.h" # include "arith.h"
# include "schedule.h" # include "schedule.h"
@ -756,6 +753,24 @@ void vvp_arith_real_::dispatch_operand_(vvp_net_ptr_t ptr, double bit)
} }
/* Real multiplication. */
vvp_arith_mult_real::vvp_arith_mult_real()
{
}
vvp_arith_mult_real::~vvp_arith_mult_real()
{
}
void vvp_arith_mult_real::recv_real(vvp_net_ptr_t ptr, double bit)
{
dispatch_operand_(ptr, bit);
double val = op_a_ * op_b_;
vvp_send_real(ptr.ptr()->out, val);
}
/* Real division. */
vvp_arith_div_real::vvp_arith_div_real() vvp_arith_div_real::vvp_arith_div_real()
{ {
} }
@ -772,6 +787,24 @@ void vvp_arith_div_real::recv_real(vvp_net_ptr_t ptr, double bit)
vvp_send_real(ptr.ptr()->out, val); vvp_send_real(ptr.ptr()->out, val);
} }
/* Real summation. */
vvp_arith_sum_real::vvp_arith_sum_real()
{
}
vvp_arith_sum_real::~vvp_arith_sum_real()
{
}
void vvp_arith_sum_real::recv_real(vvp_net_ptr_t ptr, double bit)
{
dispatch_operand_(ptr, bit);
double val = op_a_ + op_b_;
vvp_send_real(ptr.ptr()->out, val);
}
/* Real subtraction. */
vvp_arith_sub_real::vvp_arith_sub_real() vvp_arith_sub_real::vvp_arith_sub_real()
{ {
} }

View File

@ -1,7 +1,7 @@
#ifndef __arith_H #ifndef __arith_H
#define __arith_H #define __arith_H
/* /*
* Copyright (c) 2001-2005 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -18,9 +18,6 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#ifdef HAVE_CVS_IDENT
#ident "$Id: arith.h,v 1.34 2006/07/30 02:51:36 steve Exp $"
#endif
# include "vvp_net.h" # include "vvp_net.h"
@ -218,6 +215,14 @@ class vvp_arith_real_ : public vvp_net_fun_t {
}; };
class vvp_arith_sum_real : public vvp_arith_real_ {
public:
explicit vvp_arith_sum_real();
~vvp_arith_sum_real();
void recv_real(vvp_net_ptr_t ptr, double bit);
};
class vvp_arith_div_real : public vvp_arith_real_ { class vvp_arith_div_real : public vvp_arith_real_ {
public: public:
@ -226,6 +231,14 @@ class vvp_arith_div_real : public vvp_arith_real_ {
void recv_real(vvp_net_ptr_t ptr, double bit); void recv_real(vvp_net_ptr_t ptr, double bit);
}; };
class vvp_arith_mult_real : public vvp_arith_real_ {
public:
explicit vvp_arith_mult_real();
~vvp_arith_mult_real();
void recv_real(vvp_net_ptr_t ptr, double bit);
};
class vvp_arith_sub_real : public vvp_arith_real_ { class vvp_arith_sub_real : public vvp_arith_real_ {
public: public:
@ -234,54 +247,4 @@ class vvp_arith_sub_real : public vvp_arith_real_ {
void recv_real(vvp_net_ptr_t ptr, double bit); void recv_real(vvp_net_ptr_t ptr, double bit);
}; };
/*
* $Log: arith.h,v $
* Revision 1.34 2006/07/30 02:51:36 steve
* Fix/implement signed right shift.
*
* Revision 1.33 2006/01/03 06:19:31 steve
* Support wide divide nodes.
*
* Revision 1.32 2005/07/06 04:29:25 steve
* Implement real valued signals and arith nodes.
*
* Revision 1.31 2005/06/22 00:04:48 steve
* Reduce vvp_vector4 copies by using const references.
*
* Revision 1.30 2005/06/11 18:11:18 steve
* Remove unneeded references to functor.h
*
* Revision 1.29 2005/03/19 06:23:49 steve
* Handle LPM shifts.
*
* Revision 1.28 2005/03/12 06:42:28 steve
* Implement .arith/mod.
*
* Revision 1.27 2005/03/09 05:52:04 steve
* Handle case inequality in netlists.
*
* Revision 1.26 2005/02/19 01:32:52 steve
* Implement .arith/div.
*
* Revision 1.25 2005/02/04 05:13:02 steve
* Add wide .arith/mult, and vvp_vector2_t vectors.
*
* Revision 1.24 2005/01/28 05:34:25 steve
* Add vector4 implementation of .arith/mult.
*
* Revision 1.23 2005/01/22 16:21:11 steve
* Implement vectored CMP_EQ and NE
*
* Revision 1.22 2005/01/22 01:06:20 steve
* Implement the .cmp/eeq LPM node.
*
* Revision 1.21 2005/01/16 04:19:08 steve
* Reimplement comparators as vvp_vector4_t nodes.
*
* Revision 1.20 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.
*
*/
#endif #endif

View File

@ -414,7 +414,7 @@ void compile_real_array(char*label, char*name, int last, int first,
void compile_net_array(char*label, char*name, int last, int first) void compile_net_array(char*label, char*name, int last, int first)
{ {
vpiHandle obj = common_array_build(label, name, last, first); /* vpiHandle obj = */ common_array_build(label, name, last, first);
free(label); free(label);
free(name); free(name);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001-2007 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -941,12 +941,24 @@ void compile_arith_mult(char*label, long wid,
make_arith(arith, label, argc, argv); make_arith(arith, label, argc, argv);
} }
void compile_arith_mult_r(char*label, unsigned argc, struct symb_s*argv)
{
if (argc != 2) {
fprintf(stderr, "%s .arith/mult.r has wrong number of symbols\n", label);
compile_errors += 1;
return;
}
vvp_arith_real_ *arith = new vvp_arith_mult_real;
make_arith(arith, label, argc, argv);
}
void compile_arith_sub(char*label, long wid, unsigned argc, struct symb_s*argv) void compile_arith_sub(char*label, long wid, unsigned argc, struct symb_s*argv)
{ {
assert( wid > 0 ); assert( wid > 0 );
if (argc != 2) { if (argc != 2) {
fprintf(stderr, "%s .arith has wrong number of symbols\n", label); fprintf(stderr, "%s .arith/sub has wrong number of symbols\n", label);
compile_errors += 1; compile_errors += 1;
return; return;
} }
@ -972,7 +984,7 @@ void compile_arith_sum(char*label, long wid, unsigned argc, struct symb_s*argv)
assert( wid > 0 ); assert( wid > 0 );
if (argc != 2) { if (argc != 2) {
fprintf(stderr, "%s .arith has wrong number of symbols\n", label); fprintf(stderr, "%s .arith/sum has wrong number of symbols\n", label);
compile_errors += 1; compile_errors += 1;
return; return;
} }
@ -981,6 +993,18 @@ void compile_arith_sum(char*label, long wid, unsigned argc, struct symb_s*argv)
make_arith(arith, label, argc, argv); make_arith(arith, label, argc, argv);
} }
void compile_arith_sum_r(char*label, unsigned argc, struct symb_s*argv)
{
if (argc != 2) {
fprintf(stderr, "%s .arith/sum.r has wrong number of symbols\n", label);
compile_errors += 1;
return;
}
vvp_arith_real_ *arith = new vvp_arith_sum_real;
make_arith(arith, label, argc, argv);
}
void compile_cmp_eeq(char*label, long wid, void compile_cmp_eeq(char*label, long wid,
unsigned argc, struct symb_s*argv) unsigned argc, struct symb_s*argv)
{ {

View File

@ -1,7 +1,7 @@
#ifndef __compile_H #ifndef __compile_H
#define __compile_H #define __compile_H
/* /*
* Copyright (c) 2001-2007 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -169,7 +169,10 @@ extern void compile_cmp_ge(char*label, long width, bool signed_flag,
extern void compile_cmp_gt(char*label, long width, bool signed_flag, extern void compile_cmp_gt(char*label, long width, bool signed_flag,
unsigned argc, struct symb_s*argv); unsigned argc, struct symb_s*argv);
extern void compile_arith_mult_r(char*label, unsigned argc,
struct symb_s*argv);
extern void compile_arith_div_r(char*label, unsigned argc, struct symb_s*argv); extern void compile_arith_div_r(char*label, unsigned argc, struct symb_s*argv);
extern void compile_arith_sum_r(char*label, unsigned argc, struct symb_s*argv);
extern void compile_arith_sub_r(char*label, unsigned argc, struct symb_s*argv); extern void compile_arith_sub_r(char*label, unsigned argc, struct symb_s*argv);
extern void compile_dff(char*label, extern void compile_dff(char*label,

View File

@ -21,6 +21,7 @@
#include "schedule.h" #include "schedule.h"
#include "vpi_priv.h" #include "vpi_priv.h"
#include <iostream> #include <iostream>
#include <cstdlib>
#include <assert.h> #include <assert.h>
void vvp_delay_t::calculate_min_delay_() void vvp_delay_t::calculate_min_delay_()
@ -653,7 +654,7 @@ static void modpath_src_get_delays ( vpiHandle ref, p_vpi_delay delays )
vpip_time_to_timestruct(delays->da+idx, tmp[idx]); vpip_time_to_timestruct(delays->da+idx, tmp[idx]);
} }
} else { } else {
int units = src->dest->scope->time_units; /* int units = src->dest->scope->time_units; */
for (idx = 0; idx < 12; idx += 1) { for (idx = 0; idx < 12; idx += 1) {
delays->da[idx].real = vpip_time_to_scaled_real(tmp[idx], src->dest->scope); delays->da[idx].real = vpip_time_to_scaled_real(tmp[idx], src->dest->scope);
} }

View File

@ -1,9 +1,10 @@
%option never-interactive %option never-interactive
%option nounput
%{ %{
/* /*
* Copyright (c) 2001-2007 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -91,9 +92,11 @@
".arith/div.s" { return K_ARITH_DIV_S; } ".arith/div.s" { return K_ARITH_DIV_S; }
".arith/mod" { return K_ARITH_MOD; } ".arith/mod" { return K_ARITH_MOD; }
".arith/mult" { return K_ARITH_MULT; } ".arith/mult" { return K_ARITH_MULT; }
".arith/mult.r" { return K_ARITH_MULT_R; }
".arith/sub" { return K_ARITH_SUB; } ".arith/sub" { return K_ARITH_SUB; }
".arith/sub.r" { return K_ARITH_SUB_R; } ".arith/sub.r" { return K_ARITH_SUB_R; }
".arith/sum" { return K_ARITH_SUM; } ".arith/sum" { return K_ARITH_SUM; }
".arith/sum.r" { return K_ARITH_SUM_R; }
".array" { return K_ARRAY; } ".array" { return K_ARRAY; }
".array/i" { return K_ARRAY_I; } ".array/i" { return K_ARRAY_I; }
".array/real" { return K_ARRAY_R; } ".array/real" { return K_ARRAY_R; }

View File

@ -1,7 +1,7 @@
%{ %{
/* /*
* Copyright (c) 2001-2007 Stephen Williams (steve@icarus.com) * Copyright (c) 2001-2008 Stephen Williams (steve@icarus.com)
* *
* This source code is free software; you can redistribute it * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -67,8 +67,8 @@ static struct __vpiModPath*modpath_dst = 0;
%token K_ALIAS K_ALIAS_S K_ALIAS_R %token K_ALIAS K_ALIAS_S K_ALIAS_R
%token K_ARITH_DIV K_ARITH_DIV_R K_ARITH_DIV_S K_ARITH_MOD K_ARITH_MULT %token K_ARITH_DIV K_ARITH_DIV_R K_ARITH_DIV_S K_ARITH_MOD K_ARITH_MULT
%token K_ARITH_SUB K_ARITH_SUB_R K_ARITH_SUM K_ARRAY K_ARRAY_I K_ARRAY_R %token K_ARITH_MULT_R K_ARITH_SUB K_ARITH_SUB_R K_ARITH_SUM K_ARITH_SUM_R
%token K_ARRAY_S K_ARRAY_PORT %token K_ARRAY K_ARRAY_I K_ARRAY_R K_ARRAY_S K_ARRAY_PORT
%token K_CMP_EEQ K_CMP_EQ K_CMP_NEE K_CMP_NE %token K_CMP_EEQ K_CMP_EQ K_CMP_NEE K_CMP_NE
%token K_CMP_GE K_CMP_GE_S K_CMP_GT K_CMP_GT_S %token K_CMP_GE K_CMP_GE_S K_CMP_GT K_CMP_GT_S
%token K_CONCAT K_DEBUG K_DELAY K_DFF %token K_CONCAT K_DEBUG K_DELAY K_DFF
@ -275,6 +275,11 @@ statement
compile_arith_mult($1, $3, obj.cnt, obj.vect); compile_arith_mult($1, $3, obj.cnt, obj.vect);
} }
| T_LABEL K_ARITH_MULT_R T_NUMBER ',' symbols ';'
{ struct symbv_s obj = $5;
compile_arith_mult_r($1, obj.cnt, obj.vect);
}
| T_LABEL K_ARITH_SUB T_NUMBER ',' symbols ';' | T_LABEL K_ARITH_SUB T_NUMBER ',' symbols ';'
{ struct symbv_s obj = $5; { struct symbv_s obj = $5;
compile_arith_sub($1, $3, obj.cnt, obj.vect); compile_arith_sub($1, $3, obj.cnt, obj.vect);
@ -290,6 +295,11 @@ statement
compile_arith_sum($1, $3, obj.cnt, obj.vect); compile_arith_sum($1, $3, obj.cnt, obj.vect);
} }
| T_LABEL K_ARITH_SUM_R T_NUMBER ',' symbols ';'
{ struct symbv_s obj = $5;
compile_arith_sum_r($1, obj.cnt, obj.vect);
}
| T_LABEL K_CMP_EEQ T_NUMBER ',' symbols ';' | T_LABEL K_CMP_EEQ T_NUMBER ',' symbols ';'
{ struct symbv_s obj = $5; { struct symbv_s obj = $5;
compile_cmp_eeq($1, $3, obj.cnt, obj.vect); compile_cmp_eeq($1, $3, obj.cnt, obj.vect);

View File

@ -399,8 +399,10 @@ PLI_INT32 vpi_get_vlog_info(p_vpi_vlog_info vlog_info_p)
void vpi_set_vlog_info(int argc, char** argv) void vpi_set_vlog_info(int argc, char** argv)
{ {
vpi_vlog_info.product = "Icarus Verilog"; static char icarus_product[] = "Icarus Verilog";
vpi_vlog_info.version = "$Name: $"; static char icarus_version[] = "$Name: $";
vpi_vlog_info.product = icarus_product;
vpi_vlog_info.version = icarus_version;
vpi_vlog_info.argc = argc; vpi_vlog_info.argc = argc;
vpi_vlog_info.argv = argv; vpi_vlog_info.argv = argv;

View File

@ -40,7 +40,7 @@ struct __vpiVThrVec {
unsigned bas; unsigned bas;
unsigned wid; unsigned wid;
unsigned signed_flag : 1; unsigned signed_flag : 1;
char *name; const char *name;
}; };
inline static inline static
@ -427,14 +427,14 @@ vpiHandle vpip_make_vthr_vector(unsigned base, unsigned wid, bool signed_flag)
assert(wid < 65536); assert(wid < 65536);
obj->wid = wid; obj->wid = wid;
obj->signed_flag = signed_flag? 1 : 0; obj->signed_flag = signed_flag? 1 : 0;
obj->name = "T<>"; obj->name = vpip_name_string("T<>");
return &obj->base; return &obj->base;
} }
struct __vpiVThrWord { struct __vpiVThrWord {
struct __vpiHandle base; struct __vpiHandle base;
char* name; const char* name;
int subtype; int subtype;
unsigned index; unsigned index;
}; };
@ -545,7 +545,7 @@ vpiHandle vpip_make_vthr_word(unsigned base, const char*type)
assert(type[0] == 'r'); assert(type[0] == 'r');
obj->base.vpi_type = &vpip_vthr_const_real_rt; obj->base.vpi_type = &vpip_vthr_const_real_rt;
obj->name = "W<>"; obj->name = vpip_name_string("W<>");
obj->subtype = vpiRealConst; obj->subtype = vpiRealConst;
assert(base < 65536); assert(base < 65536);
obj->index = base; obj->index = base;

View File

@ -30,6 +30,7 @@
#ifdef HAVE_MALLOC_H #ifdef HAVE_MALLOC_H
# include <malloc.h> # include <malloc.h>
#endif #endif
# include <typeinfo>
# include <stdlib.h> # include <stdlib.h>
# include <limits.h> # include <limits.h>
# include <string.h> # include <string.h>

View File

@ -22,6 +22,8 @@
# include "schedule.h" # include "schedule.h"
# include "statistics.h" # include "statistics.h"
# include <stdio.h> # include <stdio.h>
# include <cstring>
# include <cstdlib>
# include <iostream> # include <iostream>
# include <typeinfo> # include <typeinfo>
# include <limits.h> # include <limits.h>