Commit Graph

58 Commits

Author SHA1 Message Date
Lars-Peter Clausen 6ea7763c31 tgt-vlog95: Consider scopes with only localparams as unique
For modules with parameters the vlog95 backend generates one module
declaration for each module instance. This is done so that different values
for the module parameters can be supported.

Local parameters are guaranteed to have the same value for all module
instances though. Add support for detecting the case that all module
parameters are local parameters and in that case only create one shared
module declaration. This is similar to what the vhdl backend does.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-09-18 17:33:20 +02:00
Lars-Peter Clausen 167005f849 tgt-vlog95: Generate initializers for package variables
While a package can not have logic defined in it. It can have
variables with initializers. These initializers currently get
ignored when converting the package to a module in the
vlog95 backend.

Make sure packages are treated the same as modules here and
that the initializers are turned into initial blocks in the
generate vlog95 code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-03-05 15:29:34 +01:00
Cary R 60a77b08d2 Add compiler and the start of vvp support for ->> 2021-02-19 23:21:51 -08:00
Martin Whitaker f4d22af4bd tgt-vlog95: fix assertion failure when function calls a void function 2020-12-13 22:46:47 +00:00
Martin Whitaker 3f49dfcd97 Fix translation of module path connection type in vlog95 target.
The target API needed to be changed to pass the connection type
through to the target code generator.
2020-04-02 12:40:59 +01:00
Martin Whitaker cab9526e6c vlog95 target: better solution for void functions with no arguments. 2019-11-09 20:14:57 +00:00
Martin Whitaker 58aa08ab64 Handle SV void functions in vlog95 target. 2019-11-09 16:14:09 +00:00
Martin Whitaker b1b91f49c8 Update vlog95 target to handle timescales for root scope tasks/functions. 2016-07-23 00:10:01 +01:00
Martin Whitaker 7c3cee5f7a Updated comment in tgt-vlog95 to reflect changes in variable initialization. 2016-03-19 14:47:38 +00:00
Martin Whitaker 5d9a196819 tgt-vlog95: Handle variable initialisation in named blocks. 2016-03-12 23:06:54 +00:00
Martin Whitaker 61ace52f31 Fix vlog95 target to not output data types in port declarations.
This avoids variable redeclaration errors.
2015-05-18 23:16:53 +01:00
Cary R 3fd622e4eb vlog95: Add support for emitting global tasks and functions 2014-10-13 09:51:55 -07:00
Cary R 4fb91ec7c7 vlog95: Add SV queue specific error message and code generation. 2014-08-25 16:41:08 -07:00
Larry Doolittle ae6743cf69 Easy changes for -Wmissing-prototypes 2014-07-10 14:07:30 -07:00
Cary R 774d173d69 Remove missing parameter warnings 2014-07-09 14:16:57 -07:00
Cary R 8f7277a5ab Remove the unused parameter warnings in tgt-vlog 2014-07-09 09:34:44 -07:00
Larry Doolittle 855bf9cfe8 Pick some low-hanging const fruit
Makes more of the code const-correct; there are still plenty of difficult-to-fix const problems left.
No behavior change expected.
2014-06-09 10:47:28 -07:00
Cary R e336eca00f vlog95: Report that array ports are not supported. 2014-04-10 14:20:22 -07:00
Cary R e4fc5806c4 vlog95: spelling fixes 2013-12-19 20:39:58 -08:00
Cary R d564e054e5 vlog95: translate most do/while loops 2013-09-23 17:31:39 -07:00
Cary R 817a38494c vlog95: add support for zero argument functions and better named block detect
Add support for translating a zero argument function by adding a dummy
argument and improve the code that looks for a named block in a process.
2013-07-24 19:41:59 -07:00
Cary R 11696e23d1 vlog95: Add support for translating a SV function return statement 2013-07-19 10:52:54 -07:00
Cary R e30334e527 Add ivl_parameter_width() function to ivl interface 2013-07-09 18:22:40 -07:00
Cary R 3e76f6d656 vlog95: more procedural $signed()/$unsigned() support
Add support for detecting when to add a $signed() or $unsigned() to
create a self-determined context. This makes the test in the test suite
pass, but there could still be issues
2013-07-09 17:55:21 -07:00
Cary R e2361fab29 vlog95: Better unsupported select warnings and variable parameter bit select
Since parameters are now passed by reference use that information to print
the parameter name in a select vs trying to figure it out by searching the
scope looking for a parameter with the same file, line and value information.

Only print the $signed() may need to be removed messages for a select
expression that will actually be cast to signed.

Use the actual parameter information to warn that -pallowsigned=1 is needed
for a parameter when the LSB > MSB.
2013-07-05 16:31:05 -07:00
Cary R cbd1b948a2 vlog95: emit an entire parameter reference by name instead of value. 2013-07-05 10:35:31 -07:00
Cary R 0e8a257ec2 vlog95: Fix the passing of the sign extend information in a CA 2013-06-27 19:44:17 -07:00
Cary R eecc3312b7 vlog95: Add $signed/$unsigned support for signals
The actual signal code is trivial, but the emit expression code needed
to be enhanced to pass a flag that says if one of the arguments in a
binary (except the shifts) or ternary (excluding the condition) context
is unsigned. This information is used to prevent emitting an explicit
$unsigned() for a signal that is used in this context since it will be
implicitly cast to unsigned.
2013-06-27 13:31:40 -07:00
Cary R 0a4d8acefb vlog95: Add support for translating a package as a module with a special name
This patch finishes the code needed to translate a SystemVerilog package to a
module with a special name. It also adds code to report that class scopes are
not supported and treats both a class and package as a top level scope.
2013-04-17 10:43:04 -07:00
Cary R fbafb915d2 Fix some cppcheck warnings 2013-04-15 11:54:15 -07:00
Cary R 03ebd2f98d vlog95: Emit a package as a module with a special name. 2013-03-11 10:46:13 -07:00
Cary R 1f9489a65d vlog95: report that package scopes are not supported. 2013-03-07 10:38:48 -08:00
Cary R 1b36aa5560 vlog95: Add code to output specify block path delays.
There are limitations with this since the compiler does not pass all
the information that was present in the original source, but it is enough
to get a valid simulation result. It is not enough for timing analysis!
specparams are also incorrectly translated to parameters so they show up
in the wrong place.
2013-02-23 14:32:49 -08:00
Cary R c4386da666 vlog95: Emit initial blocks for tasks or functions.
In SystemVerilog a task or function can initialize a variable in a task or
function. In Icarus this is done by creating an initial block that does
the assignment. We can translate this by emitting the initial block in the
enclosing module scope. This is not 100% correct since SystemVerilog
requires the initialization to be done before the other initial/always
blocks are processed. For SystemVerilog the current Icarus behavior is
incorrect, but even if it had a new process type that ran before the other
ones the best I can do for vlog95 is emit it before the normal module
processes which currently works.
2013-02-15 19:43:32 -08:00
Cary R a581e0ef0e vlog95: Report zero argument functions are not supported. 2013-02-07 17:08:59 -08:00
Cary R d9c400ac0c A scope port can be a uwire for some cases. 2013-01-24 18:28:04 -08:00
Cary R 62412700aa vlog95: Add an error message that SV strings and darrays are not supported
We can not convert SystemVerilog strings or dynamic arrays to valid vlog95.
This patch adds an error message that they are not supported. There are still
issues with converting some of the dynamic array constructs (the compiler
crashes), but the message is printed before the crash.
2012-08-06 18:20:14 -07:00
Cary R 7179274bde vlog95: Add support for some more SV constructs and add some sorry messages
This patch adds support for SystemVerilog packed arrays and adds sorry
messages for generate blocks as well as the new SV final and
fork/join_any/join_none statements.
2012-08-06 10:16:35 -07:00
Cary R dab982f39b vlog95: Major rework of nexus emitting code, etc.
Rework the nexus emitting code to correctly translate most I/O ports.
Fix a few other expression issues uncovered when port translation was
done correctly. Ignore and warn that the SV ++/-- operators and enum
types are not translatable. More updates of the nexus debug code.
2012-01-02 11:29:42 -08:00
Cary R ceaa79e95d vlog95: Add support for most unconnected ports and more signed support.
This patch adds support for correctly handling most unconnected ports.
Most important is top level ports that are the root of the conversion.

This patch also adds support for emitting more signed constructs when
they are requested. $signed() and $unsigned() are still not supported
or recognized as an error when not emitting signed constructs.
2011-03-23 11:38:05 -07:00
Cary R a6267281d9 vlog95: Add a flag to allow signed.
This patch adds a flag -pallowsigned=1 to the vlog95 converter that
tells it to allow signed signals. There is currently no code to check
for and warn/emit the $signed() and $unsigned() system functions. I
need to determine if >>> emitting should also be controlled by the
allow signed flag.
2011-03-16 10:53:51 -07:00
Cary R e375b26f78 vlog95: Add support for escaped ids and most module ports
This patch adds support for emitting escaped identifiers and adds
code to correctly emit most module port expressions/definitions.
There are some minor code optimizations/cleanup included as well.
2011-03-14 16:53:59 -07:00
Larry Doolittle e9fda22ad9 Spelling fixes
Mostly then/than confusion.  All comments or README files,
except for one user-visible change in a tgt-vlog95 error message.
2011-03-14 16:28:36 -07:00
Cary R f13fabab71 vlog95: Add partial support for CA selects, emit for loop and other fixes.
This patch adds support for emitting fixed CA selects (zero based
variable bit and array selects also work), emitting a for statement
as a single statement and fixes for numerous little bugs. It also
adds the start of emitting module port information.
2011-03-08 19:20:23 -08:00
Cary R 4679aadbd5 vlog95: Add support for printing file/line information for most line.
This patch adds a flag that emits file and line information for
most lines. This can help the user understand where the various
lines came from in the original code. They are printed as
comments so the generated code still runs correctly.
2011-02-10 19:13:12 -08:00
Cary R bfb04998c5 vlog95: Add support for UDPs, DFFs, constant nets and bug fixes.
This patch adds the following to the vlog95 converter.

  Add support for emitting  and calling UDPs.

  Generate a UDP for a synthesized DFF.

  Add the ability do emit a constant assigned to a net.
2011-02-10 19:07:51 -08:00
Cary R a2531c5015 Add support for most tran gates and rework/split out logic/lpm code.
This patch moves the logic and lpm code to a new file. It refactors
the strength emitting routine and adds support for emitting the
standard tran style of gates.
2011-02-10 19:00:28 -08:00
Cary R 05a00ff631 vlog95: Convert compiler translation back to wait and strength fixes.
This patch adds the ability to translate the code produced by the
compiler for a wait statement back into a wait statement. It also
reworks the strength emitting code to only emit a single strength
for the pull gates and fixes a bug in the strength emitting code.
2011-02-10 18:53:46 -08:00
Cary R 8744c4279d vlog95: Add CA support, other enhancements, refactoring and bug fixes.
This patch add the following functionality to the vlog95 generator.

  Add support for most CAs. Selects still don't work correctly.
  Emitting a named event as an expression.
  Enhance the ability to find a signal in a nexus.
  Add code to emit a nexus driven by a constant.
  Rework the delay/strength code for logic gates/CAs
  Refactor some of the number code.
  Refactor the variable emitting code to support named blocks.
  Translate the compiler code back to <var> = <event> <value>
2011-01-31 14:41:58 -08:00
Cary R 424fba819e vlog95: more functionality and some bug fixes.
This patch adds support for emitting an array as an expression. This is
used as a system task/function argument.

It partially reworks the real display code to print an appropriate
expression for NaN, inf and -inf. To get other real numbers to always
display correctly we need to build a custom printing routine that adjusts
what is displayed based on the actual bits in the double.

Add the ability to print a real variable delay. They are not scaled by
the compiler.

Since a delayx delay may be variable we must always enclose this type of
delay with parenthesis.

Fix the L-value concatenation to be in the correct order.

Handle the special case that an if with a single if as the true statement
does not loose any associated else clause to the enclosed if. Basically
add a begin/end pair as needed to make things work out correctly.
2011-01-31 12:01:03 -08:00