Commit Graph

6240 Commits

Author SHA1 Message Date
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 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 0106578fb6 The select not the original parameter get the file/line info.
When taking a variable part select of a parameter we need to
give file and line information to the select not the parameter.
2011-02-10 18:58:26 -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
Pawel Szostek 77a346ffb1 Added full number, based number (both int and float), string and character literals handling 2011-02-10 18:34:38 -08:00
Pawel Szostek 0395eadbc8 Introductory changes for numbers handling 2011-02-10 18:34:13 -08:00
Pawel Szostek 75203dc121 Minor changes to VHDL lexor 2011-02-10 18:33:53 -08:00
Pawel Szostek d747859a85 New compound VHDL symbols 2011-02-10 18:33:34 -08:00
Pawel Szostek ac28743eb0 New keywords to lexer added and typos corrected 2011-02-10 18:33:07 -08:00
Martin Whitaker b08120e223 Patch to improve sign extension efficiency in vvp.
Currently the vvp target emits multiple single bit %mov instructions
to perform sign extension. This patch adds a new %pad instruction
that allows sign extension to be performed with just one instruction.
2011-02-01 18:05:09 -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 1e32ce5df8 Don't include local signals in @* sensitivity list.
A locally created signal should not be included in the sensitivity
list created by @*.
2011-01-31 14:37:52 -08:00
Cary R f01b25b60c Add support for ivl_const_{file,lineno}
This patch adds support for ivl_const_file() and ivl_const_lineno()
to the target interface.
2011-01-31 12:10:03 -08:00
Cary R 6ddf754082 Add support for giving both strengths to a pull device.
In the standard a pull device can be given both a 1 and 0 strength.
Only the appropriate one is actually used. This patch adds support
for giving both pull strength to a pull device.
2011-01-31 12:02:37 -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 eb81d2fe94 Fix some bugs in task integer/real arguments.
This patch fixes the following problem in the compiler:

  An integer task argument should be marked as an integer port.

  An implicit register can be converted to either a reg or an integer.

  An old style task port should default to <no type> unless reg or some
  other type is provided. ANSI style is always defined. For example:
    input ri;
    output ro;
    inout rio;
    real ri, ro, rio;
  should define all three task ports to be of type real.
2011-01-31 11:27:11 -08:00
Cary R 633ee85dc2 vhdlpp: update make clean and vpath, add cppcheck target
This patch updates the make clean target and modifies the vpath search to
match what is done in the main ivl Makefile since this one has the same
issues it does. It also adds a cppcheck target and removes the redundant
libmisc build target since the vpath already handles this.
2011-01-26 18:07:39 -08:00
Cary R a6c02f8cb9 Some vhdlpp git cleanup.
This patch adds vhdlpp/parse.output to .gitignore and moves all the
vhdlpp depend files to the local dep directory.
2011-01-26 18:07:27 -08:00
Cary R e3324dd2ae vlog95: Don't hide exp function with variable.
This patch renames the exp variable to be exponent since exp is a math
function.
2011-01-26 18:06:00 -08:00
Cary R 60d08d5f02 vlog95: add ability for user to change space increment.
This patch adds the ability for the user to change the spacing increment
from the command line using the -pspacing=<num> flag. The is restricted to
be a value between and including 1 and 16.
2011-01-26 18:02:51 -08:00
Stephen Williams 9229256f6f Fix identation style. 2011-01-26 17:44:58 -08:00
Pawel Szostek 7eddaaf5bf Entity parsing changed 2011-01-26 17:43:26 -08:00
Cary R 6bf7e88611 Fix build of ivl with files in libmisc and vhdlpp check issues.
This patch fixes the ivl build to find files in libmisc using vpath instead
of a separate target. The existing constructs caused build problems after
running a make clean. It also adds an empty checking target to vhdlpp.
2011-01-24 13:34:47 -08:00
Jared Casper ffca523d39 Fix vhdlpp Makefile for out-of-tree builds.
The INCLUDE_PATH in the vhdlpp Makefile was not including $(srcdir)
and $(srcdir)/.. when building outside of the source tree.
2011-01-24 13:33:41 -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
Stephen Williams 591c35cd7c Merge branch 'work3' 2011-01-22 09:53:57 -08:00
Cary R 755d0b59d6 vlog95: Add support for translating some power expressions as a left shift.
If the left power operator expression is a numeric constant that has a
value 2^n n>0 then we can use a left shift to calculate the result. This
patch adds code to do this. All other power expressions are flagged as a
compilation error.
2011-01-18 17:23:46 -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 69ec4cfc6d Add support for ivl_logic_{file,lineno}
The logic devices were missing the file/line number interface. This patch
adds the routines and propagates the information as needed.
2011-01-18 17:17:18 -08:00
Stephen Williams ab8f623cea Add file/line information to entities and ports
Include the compiler infrastructure to vhdlpp for collecting the
file and line information and attaching it to entities and ports.
Make the parser store the file name during parse.

Create a libmisc library where I can put source files that are
used by multiple programs within the source tree.
2011-01-18 17:03:51 -08:00
Stephen Williams d72f7ea249 Save the type name if an InterfacePort object. 2011-01-18 17:03:51 -08:00
Stephen Williams 5a6d07ff9f Emit Verilog stubs for entities
The verilog includes the module declaration with correct ports
in the correct order. Get the port directions correct.
2011-01-18 17:03:51 -08:00
Stephen Williams 02820c9e34 Parse create entities with ports
Create entity objects from entity declarations in the source,
and populate them with ports.
2011-01-18 17:03:51 -08:00
Stephen Williams 1f6bf09984 Iverilog driver tells ivlpp how to find vhdlpp. 2011-01-18 17:03:51 -08:00
Stephen Williams 05122d3e2c Add VHDLPP support to ivlpp program
The ivlpp program is a good place to detect that the source file
is VHDL, and pass the source file to the vhdlpp program. Do so
automatically.
2011-01-18 17:03:51 -08:00
Stephen Williams 04b239a5fb Flesh out VHDL parser engine.
Add enough rules to parse a simple VHDL program:
  Parse library and use clauses,
  Parse entity declarations, and
  Parse architecture bodies.

Add some parser infrastructure:
  Handle syntax errors with useful error messages,
  Include file name and line numbers in parse errors,
  Add some parser debug aids.
2011-01-18 17:03:51 -08:00
Stephen Williams 8cf1fd1820 Introduce shell of vhdlpp program.
Create the makefiles and configuration scripts to hold together
the vhdlpp front-end program. Create a shell main.
2011-01-18 17:03:51 -08:00
Cary R ce7a6fa0da Add uwire to the multiple driver error message.
The original message talks about an unresolved net which may be
something different/more encompassing. This patch explicitly adds
uwire to the message to make it clear to the user that a uwire
could cause this message.
2011-01-15 16:02:26 -08:00
Cary R e67dcf5216 Add a vpath for the local lexor_keyword.cc
This patch doesn't completely fix the problem, but with it the problem
is at least manageable. The issues was that when the lexor_keyword.gperf
file is updated and you are building outside the source directory the
Makefile would create a local lexor_keyword.cc as expected. The problem
is that it always looked in the source directory for the file. This
patch adds a special vpath rule that says to look in the build directory
first and then in the source directory for lexor_keyword.cc.

This works as expected except for the first time the lexor_keyword.cc
file is generated locally. During the make invocation it compares the
source lexor_keyword.cc file to the gperf file and notices it is out of
date. It then generates a new file in the build directory, but the make
rule is still using the source file which didn't change so it doesn't
rebuild as needed. To get the new file to compile you need to run make
a second time to get the rule to execute using the local version of the
file. This extra make invocation is only needed when the local file is
first created since after that the rule always uses the local file.

I plan to look at resolving the remaining issue, but there is much
subtlety in this since you effectively need to break/rebuild the make
dependency tree to get this to build correctly in a single run.
2011-01-15 16:00:59 -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 dc17190f4d Keep nulls in a verinum and keep as string when padding is mod 8.
For diagnostics and to know what is really going on in the compiler
we need to keep any NULL that is in a verinum string or when
displayed as/converted to a string.

When padding a verinum string if the padding is in multiples of eight
then keep the string property.
2011-01-15 15:49:01 -08:00
Cary R 1a1b0d7551 is_cell needs to be defined for root scopes.
This patch fixes a small bug found with the vlog95 back end. A root scope
should define is_cell instead of leaving it undefined. Normally I would
expect a root scope to not be a cell, but I don't think the standard
prohibits this from happening, so copy the value from the definition.
2011-01-15 15:47:06 -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 428c1f3222 vlog95: add expression support for ternary, concat and system functions.
This patch adds support to the vlog95 convert for the ternary operator,
the concat/repeat operator and calling a system function. It also adds
the `celldefine information when appropriate.
2011-01-12 16:43:59 -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
Cary R d5352ca47a Add missing support for task ports in ivl interface
It was documented that ivl_scope_port(s)() could be used with tasks,
but the code did not support this. This patch adds that functionality
as documented. It also removes the documentation for ivl_lval_mem()
since that function no longer exists.
2011-01-12 16:40:05 -08:00