Commit Graph

5049 Commits

Author SHA1 Message Date
Stephen Williams 6e12c1f236 Elaborate of PGAssign always passes calculated width.
the PGAssign elaborate method used the test_width to get the width
of the r-value expression. This should be completely sufficient to
get the width of the expression, so always use a defined width to
elaborate the expression.
2008-09-20 19:23:54 -07:00
Stephen Williams dc313436c1 Self-determined ternary expressions use better width tester.
When ternary expressions are self-determined, use the test_width
method to get a proper reading of the expression width. Also improve
the test_width method to handle unsized operands.
2008-09-20 18:17:17 -07:00
Stephen Williams 46bf03bba4 Pad signed arguments to multiply
Arguments to multiply that are signed must be the width of the output
for the 2s complement multiply to work correctly.
2008-09-19 22:00:29 -07:00
Cary R 103b351641 Document the %assign/av/e opcode. 2008-09-19 21:13:01 -07:00
Cary R f7d3c7c711 Add non-blocking EC for arrays and other fixes.
This patch adds non-blocking event control for array words.
It also fixes a problem where the word used to put the
calculated delay for a non-blocking array assignment was
not being released. It also fixes the non-blocking array
assignments to correctly handle off the end/beginning part
selects.
2008-09-19 21:08:03 -07:00
Cary R a39b9d4ef1 Elaboration debug messages should depend on debug flag.
The debug messages for the ternary were missing a conditional
on the debug flag.
2008-09-19 20:49:02 -07:00
Martin Whitaker a4973c217d Support parameter, localparam, and event declarations in any scope.
Currently, parameters and localparams declared in tasks, functions,
generate blocks, and named blocks are placed in the parent module
scope. Event declarations in these scopes are not permitted (a
syntax error is reported). This patch corrects this behaviour, so
that all the above declarations are accepted and are placed in the
scope in which they are declared.

Note that the IEEE standard does not permit parameter declarations
in generate blocks. This patch causes the parser to reject such
declarations.
2008-09-19 20:23:14 -07:00
Cary R 626394d198 Some event control assigns can be skipped so add an event clear.
Since some event control assignments can be skipped we need an
event control clear so that future %evctl statements do not fail
their assert. This patch adds %evctl/c and uses it in the compiler
as appropriate to keep the event control information in sync.
2008-09-19 20:04:51 -07:00
Cary R 8ffec473ef Add event control for vectors and parts of a vectors.
This patch adds full event control for vectors and parts of a
vector. It also fixes the other non-blocking part select code
to correctly handle a negative offset ([1:-2] of a [4:0] will
have an offset of -2).
2008-09-19 19:46:33 -07:00
Stephen Williams 38e62bb1d2 Fix conversion of negative integer to real.
When an integer/bool value is constant and negative,
and is used in a real-valued context, fix the
code generator calculation of the negative value.
2008-09-19 17:04:40 -07:00
Cary R 2d1e0b3ade When evaluating a constant into an index make sure to clear bit 4.
When evaluating an expression into an index register bit 4 is used
to determine if the expression had any X/Z bits. In the case of a
constant immediate value this can not happen so make sure the bit
is cleared.
2008-09-18 21:52:00 -07:00
Cary R 3ba9e945d7 Fix MinGW to us _snprintf in tgt-vvp/vvp_process.c
We need consistent pointer output (%p) and under MinGW we need to
us _snprintf instead of snprintf to get this. The recent event
control addition missed this. This has been reported to the MinGW
developers and they are working on a solution.
2008-09-18 14:53:42 -07:00
Larry Doolittle 2a1608c075 Configure UL_AND_TIME without warnings
The previous patch (commit 8b0ca902a6)
dealing with the possibilities of (unsigned long) and (vvp_time64_t)
being either the same or different managed to redefine UL_AND_TIME64_DIFF
in the 64-bit case.  This does, of course, trigger a compiler warning.
That warning is repeated on every .cc file with a #include "config.h",
which is to say, just about every file.

This patch inverts the sense of the preprocessor conditional, calling
it UL_AND_TIME64_SAME.  No more warnings!
2008-09-18 14:49:11 -07:00
Stephen Williams 411ee517ee Instance arrays with multiple outputs and not vectorized.
It takes a carefully crafted source file to cause elabortion to make
an arrayed multiple-output gate that is not vectorized into a single
wide gate. But that special case does need to be handled.
2008-09-16 21:03:26 -07:00
Cary R 8b0ca902a6 We don't need a special vector4_to_value if vvp_time64_t == unsigned long.
When vvp_time64_t is equivalent to an unsigned long we do not want
(cannot have) both an unsigned long and vvp_time64_t version of
vector4_to_value().
2008-09-16 20:00:58 -07:00
Cary R 6f46930c23 Make it an error to have a `timescale inside a module definition.
While the standard is not completely clear about this, we are making
it an error for a `timescale directive to be inside a (macro)module
definition. This means that all modules and any statements contained
within have a single well defined time unit and precision.
2008-09-15 21:25:41 -07:00
Stephen Williams 0e699ca226 Handle logic gates with multiple outputs.
Logic gates usually have one output and several inputs, but a few
have multiple outputs and one input. Since the NetNode objects have
only a single output, handle the case by creating multiple NetNode
objects, one for each output.
2008-09-14 21:04:03 -07:00
Cary R 5463e5e66b More refinements on negative real variable delays.
This should do the rounding correctly on real negative delay
values.
2008-09-14 09:13:03 -07:00
Cary R 441f173ced Variable delays for .delay must be scaled correctly.
A variable that is used to set the delay of a .delay statement
must be scaled to match the local units and for real values
rounded using the precision. This value is then converted to
the simulation precision.
2008-09-14 09:12:53 -07:00
Stephen Williams d3d54144ff Be more explicit with the type matching rules.
Signals of a nexus must have types that exactly match, but the drivers
of a signal nexus have slightly more subtle rules for the case where
the signal is IVL_VT_LOGIC. Express those rules in the function
check_signal_drive_type, and use it to check the type of constants
driving a signal.
2008-09-13 20:22:48 -07:00
Stephen Williams e4c9ad2b17 Remove redundant NetPins node pointer.
Remove redundant pointer to the containing NetPins object by keeping
the pointer only in the first Link (pin 0) of an array of links. In
this link, replace the pin number with the NetPins pointer, and set
a pins_zero_ flag to indicate that this has happened. This way, only
the first pin in a Link array will have the pointer to the NetPins
that contains the array, and the pointer takes up practically no space
at all.
2008-09-13 19:49:38 -07:00
Stephen Williams 0339e9eb1e Cleanup unused junk in NetAddSub class.
This class was old, and its original design pulled literally from
the LPM reference. But of nine pins declared, only 4 were used.
Remove all the excess junk and clean up the designed dump handling
of the device.
2008-09-13 18:28:43 -07:00
Stephen Williams 7d6b391572 In continuous assignment, r-value is sized or lossless, never self determined.
The r-value expression takes on at least the width of the l-value. If
there is a sized width greater then the l-value width, take that on
instead. But if the r-value is unsized, there are unsized sub-expressions
that cause the expression as a whole to be unlimited width, so elaborate
and evalulate the r-value as lossless.
2008-09-13 17:40:19 -07:00
Stephen Williams 804f5a94d5 Manage expression types for ternary a little better.
The true and false expression clauses must have compatible types,
which are not necesarily identical. In particular, VT_BOOL and
VT_LOGIC are compatible for the purposes of ternary arguments. The
test in NetETernary::synthesize was incorrect.

In the process, fix the type handling of NetConst objects to allow
for IVL_VT_BOOL constants. This is information that the downstream
may find useful, so should be handled correctly.
2008-09-13 16:43:39 -07:00
Cary R 3d5998cd63 Allow variable delay in continuous assignments.
Add the ability to delay continuous assignments using a
variable delay.
2008-09-13 15:01:23 -07:00
Nick Gasson eda1df5df2 Avoid processing tgt-vhdl/Makefile.in twice
It's processed once by AC_OUTPUT in configure.in and then again
by AC_OUTPUT in tgt-vhdl/configure.in. This is a bug from when I
first started on the VHDL target, and was basing it on the tgt-vvp
code. The call to configure in the tgt-vhdl directory is not
actually necessary either, since it doesn't do any checks not
performed elsewhere, so that should proably be removed later.
2008-09-13 14:57:33 -07:00
Stephen Williams 3d86cc1a15 Reduce the size of Link class objects.
Put the enumerated members of the Link class into bit fields to keep
the size down to a minimum.
2008-09-13 14:51:42 -07:00
Nick Gasson c5263268ed Tidy up reduction functions in support.cc
This removes some unnecessary code duplication as the functions
only differ (or need to differ) in two places.
2008-09-13 18:20:12 +01:00
Nick Gasson e5abe182c1 Add reduction XOR/XNOR in expressions 2008-09-13 18:09:11 +01:00
Nick Gasson e5343ef73f Implement arithmetic right shift >>>
This is currently implemented using the numeric_std
shift_right function as the sra operator is not defined on
signed/unsigned types before VHDL-2006.
2008-09-13 15:23:42 +01:00
Cary R 1f9f73a4be Modify $realtime to use vpiScaledRealTime
$realtime should use vpiScaledRealTime instead of scaling the
time itself. This also allows it to work for time over 32 bits.
2008-09-12 20:36:08 -07:00
Cary R 1e60754ff0 Partial non-blocking event control implementation
This patch pushes the non-blocking event control information to
the code generator. It adds the %evctl statements that are used
to put the event control information into the special thread
event control registers. The signed version (%evctl/s) required
the implementation of %ix/getv/s to load a signed value into
an index register. It then adds %assign/wr/e event control based
non-blocking assignment for real values. It also fixes the other
non-blocking real assignments to use Transport instead of inertial
delays.
2008-09-12 20:00:28 -07:00
Larry Doolittle cdfb2315cf One more signed vs unsigned comparison fix
Introduced in a8ad505af7
Various improgements to expression ::synthesize methods
2008-09-12 19:39:15 -07:00
Nick Gasson 2516d63805 A basic translation of the Verilog power operator to VHDL
The exponentiation operator in VHDL is not defined for numeric_std
types. We can get around this by converting the operands to integers,
performing the operation, then converting the result back to the
original type. This will work OK in simulation but certainly will not
synthesise unless the operands are constant.

However, even this does not work quite correctly. The Integer type in
VHDL is signed and usually only 32 bits, therefore any result larger
than this will overflow and raise an exception. I can't see a way
around this at the moment.
2008-09-12 20:19:22 +01:00
Stephen Williams 3abf51dcad Get rid of names attached to Links.
This is simply no need for the names on links,
other then for debug messages, and there are
better ways to handle that.
2008-09-10 19:34:28 -07:00
Stephen Williams 5dfecb3789 Remove useless Link instance number. 2008-09-10 07:29:23 -07:00
Cary R 088c7f3feb Add calculated delay, real valued, non-blocking assignments.
This patch add the ability to do a non-blocking assignment
for real values using a non-constant (calculated) delay.
2008-09-09 20:09:49 -07:00
Cary R 3982781e97 Add cast to remove warning. 2008-09-09 19:24:14 -07:00
Larry Doolittle f233793061 Spelling fixes
No code changes.
2008-09-09 19:21:42 -07:00
Larry Doolittle 8704e3e34f Compatibility with gcc-4.3
Add "include"s to fix errors flagged by gcc-4.3.2
2008-09-09 19:19:51 -07:00
Nick Gasson ec2511da64 Use British spelling and fix a few typos 2008-09-09 19:57:32 +01:00
Stephen Williams 05f129211e Remove the elaborate_net methods.
These methods are no longer in use, their functionality taked over
by a compination of elab_and_eval and NetExpr::synthesize methods.
2008-09-08 21:26:26 -07:00
Stephen Williams eb9d037bf0 Remove elaborate_net from all elaborations.
Use elaborate_expr and synthesize() methods in place of the
elaborate_net methods, so that elaboration is more consistent.
2008-09-08 19:13:49 -07:00
Stephen Williams 90f55a1d00 Merge branch 'elaborate-net-rework' 2008-09-08 18:02:51 -07:00
Stephen Williams 527f5c4849 The -V flag gets version information from all parts.
When the -V flag is passed to the iverilog command, we can easily
print the version information for the driver itself, but it is also
valuable to probe all the components that would have been used for
a real compile. So the driver executes the preprocessor and the ivl
core to have them print version information.

The ivl core program also tries to load the target code generator
and get version information to print. For this to work, create a new
optional entry point "target_query" that takes a query key string as
an argument and returns a const string as the result. Use this with
the key "version" to get version information out of the target.
2008-09-07 21:54:46 -07:00
Stephen Williams 4898cd04c6 Remove redundant back-end selections.
Target selection is done by the DLL target code generator, so there
is no value having a layer of target selection ahead of it. Remove
all that redundant code and simplify the target config files to reflect
this.
2008-09-07 16:43:54 -07:00
Stephen Williams 6411e96193 Generate delay devices for sign-extend devices.
It is possible for signe-extend to have a delay attached to it. (Same
for repeat.) Handle it like other LPM devices, by stuffing a .delay
device into the output path of the device, if appropriate.
2008-09-06 18:05:18 -07:00
Stephen Williams dd47599d55 Merge branch 'master' into elaborate-net-rework 2008-09-06 17:20:14 -07:00
Nick Gasson 8fc35fa32a Avoid emitting empty string at end of $display translation
This happened if the last part of a format string was a % code.
2008-09-06 13:23:55 +01:00
Nick Gasson 6fe7583784 Cary R.'s additional system functions, real value error messages, etc.
I've changed the find_entity() error messages to asserts since
this should be fixed by the previous patch.
2008-09-06 12:06:01 +01:00