From 82aca1b02eca47095205c88410d43abe1a976b61 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Tue, 3 Jun 2008 18:44:17 +0100 Subject: [PATCH] Stub code for handling $display --- tgt-vhdl/Makefile.in | 2 +- tgt-vhdl/stmt.cc | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/tgt-vhdl/Makefile.in b/tgt-vhdl/Makefile.in index 1acdd24d7..aa9cf5953 100644 --- a/tgt-vhdl/Makefile.in +++ b/tgt-vhdl/Makefile.in @@ -49,7 +49,7 @@ dep: $(CXX) $(CPPFLAGS) $(CXXFLAGS) -MD -c $< -o $*.o mv $*.d dep -O = vhdl.o vhdl_element.o scope.o process.o +O = vhdl.o vhdl_element.o scope.o process.o stmt.o ifeq (@WIN32@,yes) TGTLDFLAGS=-L.. -livl diff --git a/tgt-vhdl/stmt.cc b/tgt-vhdl/stmt.cc index 33e07da42..a818df38b 100644 --- a/tgt-vhdl/stmt.cc +++ b/tgt-vhdl/stmt.cc @@ -21,6 +21,34 @@ #include "vhdl_target.h" #include +#include + +/* + * Generate VHDL for the $display system task. + * TODO: How is this going to work?? + */ +static int draw_stask_display(vhdl_process *proc, ivl_statement_t stmt) +{ + return 0; +} + +/* + * Generate VHDL for system tasks (like $display). Not all of + * these are supported. + */ +static int draw_stask(vhdl_process *proc, ivl_statement_t stmt) +{ + const char *name = ivl_stmt_name(stmt); + + std::cout << "IVL_ST_STASK " << name << std::endl; + + if (strcmp(name, "$display") == 0) + return draw_stask_display(proc, stmt); + else { + error("No VHDL translation for system task %s", name); + return 0; + } +} /* * Generate VHDL statements for the given Verilog statement and @@ -28,5 +56,13 @@ */ int draw_stmt(vhdl_process *proc, ivl_statement_t stmt) { - return 0; + switch (ivl_statement_type(stmt)) { + case IVL_ST_STASK: + return draw_stask(proc, stmt); + default: + error("No VHDL translation for statement at %s:%d (type = %d)", + ivl_stmt_file(stmt), ivl_stmt_lineno(stmt), + ivl_statement_type(stmt)); + return 1; + } }