Commit Graph

40 Commits

Author SHA1 Message Date
Larry Doolittle 6ebb57195b Fuss with C function prototypes
119 formal void parameters added to keep -Wstrict-prototypes happy.
Process found one real missing prototype in vpi/vcd_priv.h:
EXTERN void vcd_names_delete(struct vcd_names_list_s*tab);
8 such warnings left, all in Tony's code
2014-07-08 13:44:11 -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 7fa2a4ccf3 vlog95: add support for emitting nested class L-values 2013-12-19 20:40:07 -08:00
Cary R 97d06b107f Add support for wait fork to the compiler and code generators 2013-10-22 09:41:03 -07:00
Cary R c64b8900ca Add support for disable fork to the compiler. 2013-10-17 19:34:57 -07:00
Cary R d564e054e5 vlog95: translate most do/while loops 2013-09-23 17:31:39 -07:00
Cary R d8f945be23 Add support for SV do/while 2013-09-16 20:02:09 -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 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 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 98694f15ce vlog95: A valid task output can have a cast.
When looking for a task call with arguments the output port assignments can
also come from a cast of a simple signal in the task.
2013-04-18 12:40:13 -07:00
Cary R 2e86c208d1 vlog95: Add support for variable packed array accesses 2013-02-20 22:10:00 -08:00
Cary R 41c7aa9e83 vlog95: translate darray and class assignments/references
These are not supported in vlog95, but they are easy to translate into
something that looks correct.
2013-02-08 19:16:24 -08:00
Cary R b6ec138644 vlog95: Add support for recognizing a call to an automatic task.
Automatic tasks are not supported by 1364-1995, but the converter should
be able to correctly convert a call to an automatic task.
2013-02-07 17:08:43 -08:00
Cary R 429babf831 vlog95: Translate some assignment with opcode statements.
This patch updates the code to translate the SystemVerilog assignments with
an opcode to the appropriate vlog95. This includes ++ and -- when used in
a statement context. The ++ and -- operators are not currently translated
in an expression context. This translation only occurs in two places:
A simple assignment statement (foo += 2;) and the increment of a for
statement. I still need to check if there are other places where these
operators are allowed.
2012-08-07 16:45:21 -07:00
Cary R 8158153ea4 vlog95: Add checks for missing assignments with opcodes
SystemVerilog supports using assignments with opcodes (e.g. +=). This
patch checks for these in a few common places and prints a warning
that they are not currently supported. Eventually the simple cases
will be converted.
2012-08-06 19:19:02 -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 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
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 b019c21f46 OpenSolaris portability/bug fixes.
A valarray of an enum does not initialize to 0 so explicitly specify the
value to fill the array with. This was causing the compiler to incorrectly
report that fixed width elements in a concatenation had no size.

The following was done to remove compiler warning when using the native
compiler on OpenSolaris.

Remove the anonymous unions in tgt-vlog95/stmt.c and tgt-vvp/vvp_process.c.

Use UINT_MAX for the maximum unsigned unsigned instead of -1 in
tgt-vvp/draw_net_input.c.

Even though lex defines yywrap() to have no arguments when %option
noyywrp is used it generates a define that takes an argument that is not
used. The compiler warned about this so remove the option and add a
dummy yywrap function.
2011-03-04 10:31:47 -08:00
Cary R d541ef4709 vlog95: Various bug fixes/improvements
This patch fixes a couple bugs and improves the checking for blocks
that really represent a single statement.
2011-03-01 18:56:04 -08:00
Cary R b95e46e621 vlog95: Add more procedural variable indexed part select code
This patch adds the rest of the functionality needed to correctly
emit both L-value and R-value procedural variable indexed part
selects as a concatenation of variable bit selects.
2011-02-28 19:19:27 -08:00
Cary R 757611b8e9 vlog95: Add partial support for procedural variable indexed part selects.
This patch adds partial support of procedural variable indexed part
selects (both R and L-value). The restriction is that this currently
only works on a zero based little endian vector. I need to know if
the select is an up or down select to correctly denormalize the base
expression for the general case.
2011-02-28 18:37:01 -08:00
Cary R df85a33583 vlog95: Rework some of the delay emitting code and enclose unary in ()
This patch reworks the delay emitting code to handle delay expressions
better. It also encloses the emitted unary operators in parenthesis to
make sequenced unary operators work properly.
2011-02-28 18:31:03 -08:00
Cary R 88cec4d6f6 vlog95: Fix pull gate bug, emit local expr sigs as CA, etc.
This patch fixes the following bugs in the vlog95 converter:

When emitting a signal as an expression, if the signal is local then
emit the expression that is driving the local signal.

The casts need to emit the expression.

When emitting pull devices they have different default strength rules
(pull is the default).

For compatibility pull devices should only have a single output net.

Extend the code that searches for the <var> = <delay> <value> pattern
to also check for an <event>. The previous event code only looks for
the repeat event pattern.
2011-02-28 18:28:21 -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 131a3d81d8 vlog95: Add the ability to recreate most variable parameter selects
This patch adds code that when it find a select of a constant it looks
for a parameter in the enclosing scope and the module scope that has
the same line, file and value information. If it find one that is
used to rebuild the expression. A more exhaustive search is need to
make this 100% clean.

It also uses the named scope when emitting statement inside a named
begin or fork instead of the enclosing scope.
2011-02-10 19:02:38 -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 1908f28d5b vlog95: Better handling of NOOP statements.
A NOOP at the end of an existing statement can be represented as ";\n"
(a simple line termination).  In general a NOOP represents an empty
begin/end pair.
2011-01-31 14:42:06 -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
Cary R 72ede358ad vlog95: add support for calling a task with arguments
This patch adds code to decode a begin block that the compiler uses to
represent calling a task with arguments.
2011-01-31 11:59:32 -08:00
Cary R dd0ea9db40 vlog95: Add partial support for getting a nexus name, etc.
This patch adds preliminary support for finding the correct name for
a nexus at a given scope level. It also does the following.

Report that real modulus is not supported.
Fix a bug in the generation of concat expressions.
Add missing generation of unary ! operator.
Add ability to generate > integer delays.
Refactor some of the support code.
Make some of the error messages more descriptive.
Ignore the ALLOC and FREE statements (only used with automatic tasks).
2011-01-24 13:31:10 -08:00
Cary R 5cec7e3870 Remove some cppcheck warnings about variable scope.
There were a couple variable that could have reduced scope.
2011-01-18 17:22:11 -08:00
Cary R 203a8cc997 Add more functionality to the vlog95 back end.
This patch adds significantly more functionality to the vlog95 back end.
The following are the major additions:

Display unsigned numbers without undefined bits in hex.
Add support for both L-Value and R-value bit and part selects.
Added support for out of scope references.
Added support for emitting logic gates (range not finished, name is invalid).
Added support for emitting initial/always blocks.
Add support for event inter statement delays.
Convert a blocking inter statement delay assign back to the original form.
Added support for rescaling variable delays.
Added support for the disable statement.
Added support for an event trigger statement (event name is missing).
Added support for calling a user task (calling arguments are missing).
Added support for an event based delay statement (@) (event name is missing)

Not all of these are working as expected since there is not currently a
routine to find a nexus name as a function of scope (needed for event names,
logic gate ports, etc.). Since the Icarus compiler generates structural code
the arguments to modules, module instantiations and calling user tasks are
also still missing.
2011-01-18 17:22:02 -08:00
Cary R 6581b13005 vlog95: add support for a scope and user function call expression.
This patch adds support for using a scope in an expression and calling
a user function. It also fixes an issue in the module name mangling
and calling a system task/function with multiple arguments.
2011-01-15 15:59:50 -08:00
Cary R 3c10eb2956 vlog95: add support for case statements and initial module instantiation.
This patch adds support for the various case statements and adds
preliminary support for instantiating modules. The module instantiation,
just like the module definition, is still missing ports. Adding this
will require modification to the compiler to get the port order correct.
Because of defparams and passed parameters any module that has a
parameter must be generated uniquely for each instance since they may not
all be the same. Modules without parameters are only generated once.
2011-01-15 15:58:43 -08:00
Cary R dc7bb9149e vlog95: Add support for more statements and a delay expression
This patch adds the ability to print a delay expression (it is rescaled
to the module timescale) and adds support the following statement types:

  nonblocking assignment with a delay (event control is still missing)
  condition (if/else)
  forever
  repeat
  while (Icarus translated for loops to while loops)
  fork
  procedural continuous assign
  deassign
  force
  release
2011-01-15 15:45:08 -08:00
Cary R 50106547e3 Extend the vlog95 converter
This patch adds more support to the Verilog 1995 converter. There is
still a lot that is missing and there is still some implemented
functionality that is not 100%.
2011-01-12 16:43:50 -08:00