Cary R.'s additional system functions, real value error messages, etc.
I've changed the find_entity() error messages to asserts since this should be fixed by the previous patch.
This commit is contained in:
parent
a34348bb35
commit
6fe7583784
|
|
@ -40,7 +40,7 @@ CPPFLAGS = @ident_support@ -I. -I$(srcdir)/.. @CPPFLAGS@ @DEFS@ @PICFLAG@
|
|||
CXXFLAGS = -Wall @CXXFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
|
||||
all: dep vhdl.tgt vhdl.conf
|
||||
all: dep vhdl.tgt vhdl.conf vhdl-s.conf
|
||||
|
||||
dep:
|
||||
mkdir dep
|
||||
|
|
@ -74,7 +74,8 @@ distclean: clean
|
|||
|
||||
check: all
|
||||
|
||||
install: all installdirs $(libdir)/ivl/vhdl.tgt $(libdir)/ivl/vhdl.conf
|
||||
install: all installdirs $(libdir)/ivl/vhdl.tgt $(libdir)/ivl/vhdl.conf \
|
||||
$(libdir)/ivl/vhdl-s.conf
|
||||
|
||||
$(libdir)/ivl/vhdl.tgt: ./vhdl.tgt
|
||||
$(INSTALL_PROGRAM) ./vhdl.tgt $(DESTDIR)$(libdir)/ivl/vhdl.tgt
|
||||
|
|
@ -82,6 +83,9 @@ $(libdir)/ivl/vhdl.tgt: ./vhdl.tgt
|
|||
$(libdir)/ivl/vhdl.conf: vhdl.conf
|
||||
$(INSTALL_DATA) $< $(DESTDIR)$(libdir)/ivl/vhdl.conf
|
||||
|
||||
$(libdir)/ivl/vhdl-s.conf: vhdl-s.conf
|
||||
$(INSTALL_DATA) $< $(DESTDIR)$(libdir)/ivl/vhdl-s.conf
|
||||
|
||||
installdirs: ../mkinstalldirs
|
||||
$(srcdir)/../mkinstalldirs $(DESTDIR)$(libdir)/ivl
|
||||
|
||||
|
|
|
|||
|
|
@ -505,8 +505,42 @@ static vhdl_expr *translate_concat(ivl_expr_t e)
|
|||
|
||||
vhdl_expr *translate_sfunc_time(ivl_expr_t e)
|
||||
{
|
||||
cerr << "warning: no translation for time (returning 0)" << endl;
|
||||
return new vhdl_const_int(0);
|
||||
cerr << "warning: no translation for $time (returning 0)" << endl;
|
||||
vhdl_expr *result = new vhdl_const_int(0);
|
||||
result->set_comment("$time not supported, returned 0 instead!");
|
||||
return result;
|
||||
}
|
||||
|
||||
vhdl_expr *translate_sfunc_stime(ivl_expr_t e)
|
||||
{
|
||||
cerr << "warning: no translation for $stime (returning 0)" << endl;
|
||||
vhdl_expr *result = new vhdl_const_int(0);
|
||||
result->set_comment("$stime not supported, returned 0 instead!");
|
||||
return result;
|
||||
}
|
||||
|
||||
vhdl_expr *translate_sfunc_simtime(ivl_expr_t e)
|
||||
{
|
||||
cerr << "warning: no translation for $simtime (returning 0)" << endl;
|
||||
vhdl_expr *result = new vhdl_const_int(0);
|
||||
result->set_comment("$simtime not supported, returned 0 instead!");
|
||||
return result;
|
||||
}
|
||||
|
||||
vhdl_expr *translate_sfunc_random(ivl_expr_t e)
|
||||
{
|
||||
cerr << "warning: no translation for $random (returning 0)" << endl;
|
||||
vhdl_expr *result = new vhdl_const_int(0);
|
||||
result->set_comment("$random not supported, returned 0 instead!");
|
||||
return result;
|
||||
}
|
||||
|
||||
vhdl_expr *translate_sfunc_fopen(ivl_expr_t e)
|
||||
{
|
||||
cerr << "warning: no translation for $fopen (returning 0)" << endl;
|
||||
vhdl_expr *result = new vhdl_const_int(0);
|
||||
result->set_comment("$fopen not supported, returned 0 instead!");
|
||||
return result;
|
||||
}
|
||||
|
||||
vhdl_expr *translate_sfunc(ivl_expr_t e)
|
||||
|
|
@ -514,6 +548,14 @@ vhdl_expr *translate_sfunc(ivl_expr_t e)
|
|||
const char *name = ivl_expr_name(e);
|
||||
if (strcmp(name, "$time") == 0)
|
||||
return translate_sfunc_time(e);
|
||||
else if (strcmp(name, "$stime") == 0)
|
||||
return translate_sfunc_stime(e);
|
||||
else if (strcmp(name, "$simtime") == 0)
|
||||
return translate_sfunc_simtime(e);
|
||||
else if (strcmp(name, "$random") == 0)
|
||||
return translate_sfunc_random(e);
|
||||
else if (strcmp(name, "$fopen") == 0)
|
||||
return translate_sfunc_random(e);
|
||||
else {
|
||||
error("No translation for system function %s", name);
|
||||
return NULL;
|
||||
|
|
@ -551,6 +593,10 @@ vhdl_expr *translate_expr(ivl_expr_t e)
|
|||
return translate_concat(e);
|
||||
case IVL_EX_SFUNC:
|
||||
return translate_sfunc(e);
|
||||
case IVL_EX_REALNUM:
|
||||
error("No VHDL translation for real expression at %s:%d",
|
||||
ivl_expr_file(e), ivl_expr_lineno(e));
|
||||
return NULL;
|
||||
default:
|
||||
error("No VHDL translation for expression at %s:%d (type = %d)",
|
||||
ivl_expr_file(e), ivl_expr_lineno(e), type);
|
||||
|
|
|
|||
|
|
@ -157,9 +157,10 @@ void draw_nexus(ivl_nexus_t nexus)
|
|||
ivl_net_const_t con;
|
||||
if ((log = ivl_nexus_ptr_log(nexus_ptr))) {
|
||||
ivl_scope_t log_scope = ivl_logic_scope(log);
|
||||
vhdl_scope *vhdl_scope =
|
||||
find_entity(ivl_scope_name(log_scope))->get_arch()->get_scope();
|
||||
|
||||
vhdl_entity *ent = find_entity(ivl_scope_name(log_scope));
|
||||
assert(ent);
|
||||
|
||||
vhdl_scope *vhdl_scope = ent->get_arch()->get_scope();
|
||||
if (visible_nexus(priv, vhdl_scope)) {
|
||||
// Already seen this signal in vhdl_scope
|
||||
}
|
||||
|
|
@ -177,9 +178,10 @@ void draw_nexus(ivl_nexus_t nexus)
|
|||
}
|
||||
else if ((lpm = ivl_nexus_ptr_lpm(nexus_ptr))) {
|
||||
ivl_scope_t lpm_scope = ivl_lpm_scope(lpm);
|
||||
vhdl_scope *vhdl_scope =
|
||||
find_entity(ivl_scope_name(lpm_scope))->get_arch()->get_scope();
|
||||
|
||||
vhdl_entity *ent = find_entity(ivl_scope_name(lpm_scope));
|
||||
assert(ent);
|
||||
|
||||
vhdl_scope *vhdl_scope = ent->get_arch()->get_scope();
|
||||
if (visible_nexus(priv, vhdl_scope)) {
|
||||
// Already seen this signal in vhdl_scope
|
||||
}
|
||||
|
|
@ -196,6 +198,11 @@ void draw_nexus(ivl_nexus_t nexus)
|
|||
}
|
||||
}
|
||||
else if ((con = ivl_nexus_ptr_con(nexus_ptr))) {
|
||||
if (ivl_const_type(con) == IVL_VT_REAL) {
|
||||
error("No VHDL translation for real constant (%g)",
|
||||
ivl_const_real(con));
|
||||
continue;
|
||||
}
|
||||
if (ivl_const_width(con) == 1)
|
||||
priv->const_driver = new vhdl_const_bit(ivl_const_bits(con)[0]);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -69,7 +69,13 @@ static int draw_stask(vhdl_procedural *proc, stmt_container *container,
|
|||
else if (strcmp(name, "$finish") == 0)
|
||||
return draw_stask_finish(proc, container, stmt);
|
||||
else {
|
||||
error("No VHDL translation for system task %s", name);
|
||||
vhdl_seq_stmt *result = new vhdl_null_stmt();
|
||||
ostringstream ss;
|
||||
ss << "Unsupported system task " << name << " omitted here ("
|
||||
<< ivl_stmt_file(stmt) << ":" << ivl_stmt_lineno(stmt) << ")";
|
||||
result->set_comment(ss.str());
|
||||
container->add_stmt(result);
|
||||
cerr << "Warning: no VHDL translation for system task " << name << endl;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
functor:synth2
|
||||
functor:synth
|
||||
functor:syn-rules
|
||||
functor:cprop
|
||||
functor:nodangle
|
||||
-t:dll
|
||||
flag:DLL=vhdl.tgt
|
||||
|
|
@ -512,6 +512,7 @@ void vhdl_const_string::emit(std::ostream &of, int level) const
|
|||
void vhdl_null_stmt::emit(std::ostream &of, int level) const
|
||||
{
|
||||
of << "null;";
|
||||
emit_comment(of, level, true);
|
||||
}
|
||||
|
||||
void vhdl_fcall::emit(std::ostream &of, int level) const
|
||||
|
|
@ -584,6 +585,7 @@ void vhdl_const_bit::emit(std::ostream &of, int level) const
|
|||
void vhdl_const_int::emit(std::ostream &of, int level) const
|
||||
{
|
||||
of << value_;
|
||||
// We need to find a way to display a comment, since $time, etc. add one.
|
||||
}
|
||||
|
||||
void vhdl_const_bool::emit(std::ostream &of, int level) const
|
||||
|
|
|
|||
Loading…
Reference in New Issue