Commit Graph

6076 Commits

Author SHA1 Message Date
Cary R 54ed0832db Convert a single % at the end of a format string to %%.
If there is a single % at the end of a format string then automatically
convert this to %% so that we get a single % in the output.
2011-04-20 18:13:19 -07:00
Cary R 4006bb2336 Some more cppcheck cleanup.
This patch cleans up most of the warnings in the main (ivl) directory.
2011-04-20 18:09:11 -07:00
Cary R c75d30455d Preliminary support for $table_model.
This patch adds preliminary support for implementing the $table_model()
function for Verilog-A. It is not currently functional, but the VPI
interface routines and data file parsing are mostly complete. The big
things left are building the data structures and adding the interpolation
and extrapolation routines.

We also need to fix vvp to identify constant strings/parameters in a
structural context.
2011-04-20 18:07:01 -07:00
Cary R ccf771ec4b Use the ivl malloc, etc. routines in the sys_queue code.
We want to use the ivl definitions for malloc, etc. to check for
errors. This patch adds the include for this to sys_queue.c.
2011-04-20 18:05:28 -07:00
Cary R 8b8e181fe2 vlog95: Print structural string constants and a few other fixes
This patch adds the ability to print a constant string in a
structural context. It also fixes the argument order for
structural function calls and makes a few improvements in
nexus identification.
2011-04-20 17:50:41 -07:00
Cary R 2158ebdf0b Fix a few minor cppcheck warnings.
This patch fixes a minor memory leak and slight inefficiency
reported by cppcheck. It also updates the expected warning for
vpi/fstapi.c.
2011-04-20 17:48:09 -07:00
Cary R 56b04891e0 Pass structural constant string information to the ivl interface.
This patch adds code to the compiler so that a constant string
in a structural context can maintain the string property. This
is needed but not currently implemented in vvp (it's still
converted to a number). A pending patch for the vlog95 target
does use this new information.
2011-04-20 17:29:35 -07:00
Cary R 12df29af55 Fix space issues.
Thsi patch removes space before end of line, etc.
2011-04-20 17:26:52 -07:00
Cary R c67f1b5bc2 Add support for calculating the average queue wait time.
This patch adds support for calculating the average queue wait
time. This is accomplished by keeping two 64 bit values that
represent the high and low total wait time for all previous
queue elements. The current wait time for any elements still
in the queue are added to this total. The wait time total is
then divided by the total number of items added to the queue.
2011-04-20 16:57:34 -07:00
Stephen Williams 3ff7a8f7b0 Add support for constants and package types.
Significant rework of scope management to unify the handling of
types in the ieee library and types/constants/components in packages.
This involved adjusting the parser rules to manage a stack of scopes
and rewriting the IEEE library support to not use global maps for
the loaded types.
2011-04-17 17:19:09 -07:00
Stephen Williams 303f057de1 Support collecting ALL component declarations from a used scope. 2011-04-13 19:55:18 -07:00
Stephen Williams e017ccb5d2 Merge branch 'master' into work5
Conflicts:
	vhdlpp/architec.h
	vhdlpp/debug.cc
2011-04-13 19:09:51 -07:00
Martin Whitaker f34a3020a6 Fix for lossless width estimation in shift operations.
If the right hand operand of a shift is a signed vector value, it
is coerced to an unsigned value. This needs to be allowed for when
estimating the width expansion caused by a shift in a lossless
expression.
2011-04-13 18:55:54 -07:00
Cary R 2517ba9041 Fix a few problems with the power operator.
The power operator defines 2**-1 and -2**-1 to be zero. This patch fixes
both the procedural and continuous assignments to work correctly. It also
fixes a problem in the compiler power code so that the one constant value
always has at least two bits.
2011-04-13 18:52:27 -07:00
Cary R 691113208f Add support for calculating the queue mean inter-arrival time.
This patch adds support for calculating the queue mean inter-arrival
time. This is just the latest add time minus the first add time
divided by the number of intervals (the number of adds minus one).
2011-04-13 18:49:07 -07:00
Cary R 7a473166d9 Add the stochastic (queue) tasks/function
This patch adds full support for the stochastic tasks/functions except
the mean inter-arrival and average wait statistics are not currently
available. These will be added in a later patch. This implementation
goes a bit beyond the standard and supports the following:

 1. The job and inform arguments support 32 bit four state values.
 2. The id for all routines, the job and inform arguments for $q_add(),
    the statistic code for $q_exam() along with the queue type and
    maximum length arguments for $q_initialize() can be less than or
    equal to 32 bits. The argument will be sign extended if needed to
    fill the internal 32 bit value.
 3. The job and inform arguments to $q_remove() and the status argument
    for all the routines must be 32 bits, but do not have to be an
    integer variable (e.g. a 32 bit register or part select is OK).
 4. An undefined bit in the id argument for any of the routines will
    return a status of 2 (undefined queue id). Undefined bits are not
    automatically converted to zero.
 5. Undefined bits in the $q_initialize() queue type and maximum
    length arguments or the $q_exam() statistic code argument are also
    flagged as an error (are not converted to zero).
 6. The $q_full() function returns 2 on error, the other routines that
    return a value $q_remove() job/inform arguments and the $q_exam()
    statistic value argument will usually return x on error.
 7. An invalid statistic code will set the $q_exam() status to 8.
 8. The $q_exam() statistic value argument can be 32 bits or larger.
    This allows returning large statistical time values.
 9. All time values are internally saved in simulation time units.
    They will be converted to the calling module's time unit (with
    rounding) before they are returned.
10. If a $q_exam() statistical value is too large to fit into the
    variable the maximum positive value will be returned and the
    status code will be set to 9 (value is too large).
11. If a statistical value is currently undefined $q_exam() will
    return 10 (no statistical information) (e.g. using code 5 on an
    empty queue).
2011-04-13 18:48:57 -07:00
Cary R 2b95e9b463 Forward port the LEX/YACC definition changes from V0.9
It's best to use the LEX and YACC definitions instead of hard coding
flex/bison so they can be overridden if needed.
2011-04-13 18:46:57 -07:00
Martin Whitaker 1e9f9685cc First step towards supporting constant user functions.
This patch allows the compiler to perform early elaboration
of functions if they are encountered in expressions that are
elaborated before the function would normally be elaborated.
This makes the function available for constant evaluation.
Suitable error messages are generated if a function that is
used in a constant expression is not a valid constant function.
2011-04-13 18:40:19 -07:00
Cary R 428755ce62 Fix for compilation problem created by constant expr. rework
This patch fixes a compilation problem in the UDP range code created since
it and the constant expression rework were done at the same time.
2011-04-13 18:35:27 -07:00
Cary R 0bc746dab0 Add message that a UDP with a range is not currently supported.
For now Icarus doesn't support a UDP instantiation with a range.
Instead of generating a warning about the port count being wrong
this patch adds code to calculate the range and print a message
if a range greater than one is found.
2011-04-13 18:35:21 -07:00
Stephen Williams d4c5cfc584 Add packages and component declarations within those packages.
This creates the Package class to represent packages, and the
Scope class to represent scopes in general. The library functions
are worked up to support scanning scopes for declarations that are
imported by "use" clauses.
2011-04-13 18:30:00 -07:00
Stephen Williams 791adfab68 Check ports match up in component instantiations.
Make sure in a conponent instantiation that the instantiated
component is really declared, and that the ports of the binding
really do match the ports of the declared component. This requires
that we create and save component declarations, and that components
have methods for mapping the ports.
2011-04-10 09:42:22 -07:00
Nick Gasson c81645ff46 tgt-vhdl: Fix expression generation corner case and bug in xnor reduction operator
Certain types of expressions involving only constants would produce
ambiguous VHDL output. Fixed by qualifying one of the arguments. E.g.

   ('0' or '1') = '1'

Which is ambiguous becomes

   (std_logic'('0') or '1') = '1'

This fixes the xnor_test test.

Reduce XNOR was implemented incorrectly because of trivial typo
2011-04-06 19:20:25 -07:00
Nick Gasson 9a48166855 tgt-vhdl: Improve temporary signal name generation to avoid collisions
Fixes regression of simple_gen test.

Also extended ivl_lpm_size API call to support all LPM types. This
simplifies some of the VHDL LPM generation code a little.
2011-04-06 19:18:08 -07:00
Larry Doolittle 186a677f4a Add HAVE_LROUND to config.h.in
Needed by verinum.cc
2011-04-06 19:13:56 -07:00
Cary R c5b83bf2ee Add vpiBitVar to the memory cleanup code.
Support for vpiBitVar also needed to be added to the memory (valgrind)
cleanup code.
2011-04-06 19:11:02 -07:00
Martin Whitaker 86801bef52 Fix for compiler crash when function arguments are unknown.
When a user or system function is called on the RHS of a continuous
assignment, and one of the function arguments is an undeclared
identifier, the compiler reports the error correctly but then
crashes. This patch fixes the crash.
2011-04-06 18:58:41 -07:00
Martin Whitaker 93067149f1 Rework of constant expression error reporting.
This patch changes the method used to signal that a constant expression
is being elaborated from flags stored in global variables to flags
passed down the call chain. It also generates more informative error
messages when variable references are found in a constant expression.
2011-04-06 18:50:53 -07:00
Pawel Szostek 240880d81b Change indentation mechanism in debug dump for VHDL
There has been added additional default attribute to
all 'dump' function calls which is in all cases equal
to 0. Now one can specify how much this debug dumping should
be intended. This should allow people to dump smoothly whole
designs (as it was now) as far as separate units.

This is now the parent who specifies the base indentation
for all components (children). For example, architecture
"decides" how much their signals should be indented.
2011-04-06 18:46:48 -07:00
Stephen Williams 298495be97 Add vpiBitVar support is $display and other vpi functions. 2011-04-03 17:44:23 -07:00
Stephen Williams d83728031d Over-zealous assertion checking PartSelect::PV widths. 2011-04-03 17:44:11 -07:00
Stephen Williams 098bbeea7c Support collapse of PartSelect::PV to concatenation
During elaboration, it is sometimes efficient to collapse a
collections of PV drivers to a net to a single concatenation.
This removes a bunch of resolutions and other nodes, and also
is the only way that 2-value logic should work.
2011-04-03 17:43:57 -07:00
Stephen Williams 71743c687a Over-zealous assertion checking PartSelect::PV widths. 2011-04-03 17:41:52 -07:00
Stephen Williams 28c9f420c6 Add vpiBitVar support is $display and other vpi functions. 2011-04-03 17:22:12 -07:00
Stephen Williams 1154a78596 Support collapse of PartSelect::PV to concatenation
During elaboration, it is sometimes efficient to collapse a
collections of PV drivers to a net to a single concatenation.
This removes a bunch of resolutions and other nodes, and also
is the only way that 2-value logic should work.
2011-04-03 17:21:43 -07:00
Stephen Williams 7d53ac342f Fix handling of bool(bit) vectors with odd widths. 2011-04-02 15:58:51 -07:00
Stephen Williams e5f52320e6 Fix handling of bool(bit) vectors with odd widths. 2011-04-02 15:50:49 -07:00
Stephen Williams 5188fa4a69 Merge branch 'master' into work5 2011-04-02 10:37:24 -07:00
Pawel Szostek 9bdc040520 Add missing ``sorry'' messages in VHDL parsing 2011-04-02 09:30:36 -07:00
Pawel Szostek cef37e0a4b Add component specification parsing
A class for component specification has been added
2011-04-02 09:29:42 -07:00
Pawel Szostek 830b7cf122 Add basic instantiation list handling in VHDL
A class for representing instantiation list has
been added.
2011-04-02 09:27:58 -07:00
Pawel Szostek 2af35040cc Fix constructs sequence in bison file for VHDL 2011-04-02 09:24:34 -07:00
Pawel Szostek 26e6865bef Add entity aspects to VHDL parsing
Entity aspects are now recognized and parsed
into corresponding objects. A new class (entity_aspect)
has been added.
2011-04-01 17:03:45 -07:00
Stephen Williams 9fbcc895a8 Basic elaboration of vhdl component instantiations.
This gets us as far as emiting a component instantiation. Very little
error checking/elaboration is done, so there is room for improvement,
but this is a working stub.
2011-03-31 19:11:48 -07:00
Stephen Williams abb03632dd Basic elaboration of vhdl component instantiations.
This gets us as far as emiting a component instantiation. Very little
error checking/elaboration is done, so there is room for improvement,
but this is a working stub.
2011-03-31 19:07:43 -07:00
Pawel Szostek 37d6de344d Add use clause parsing
Up till now only "global" use clauses were parsed
and as a result libraries were loaded.

Since use clauses can appear not only in global context,
parsing of non-global clauses has been introduced and
selected names are now handled (like name1.name2.name3).
2011-03-31 18:57:25 -07:00
Stephen Williams f61428dc82 Basic elaboration of vhdl component instantiations.
This gets us as far as emiting a component instantiation. Very little
error checking/elaboration is done, so there is room for improvement,
but this is a working stub.
2011-03-31 18:50:48 -07:00
Stephen Williams 1688828b4d Merge branch 'master' into work5
Conflicts:
	vhdlpp/parse.y
2011-03-29 09:37:28 -07:00
Larry Doolittle 8a568055f6 Spelling fixes
All are in comments and .txt files except for one in the Architecture::Statement dump message.
2011-03-29 08:56:10 -07:00
Stephen Williams 162b26c101 Add more complete support for vhdl local signals.
These signals are declared in the architecture and are local to
the module. The Architecture already parsed and stored these signal
declarations, but this patch adds the ability to actually emit these
signals in the generated code.

In the process of doing this, I had to regularize the elaboration
and emit of VTypes, so that it can be used in multiple places, not
just in entity headers (for ports).

I also added support for bit selects of signals. This effected a couple
places in the parser, and expressions in general.
2011-03-28 14:34:02 -07:00