Commit Graph

7964 Commits

Author SHA1 Message Date
Stephen Williams fdcb073c14 Fix a variety of bugs in vpi_handle_by_name.
This function was apparently not well tested, because any use of
acc_handle_object() triggered a use of vpi_handle_by_name that was
buggy.

The implementation was awkwardly written, to parts of it were redone.
2014-04-13 16:25:30 -07:00
Cary R 734d56ce25 Remove space issue. 2014-04-10 14:37:07 -07:00
Cary R a5423ce5ce Update FST and related files to match the latest from GTKWave 2014-04-10 14:34:39 -07:00
Cary R e336eca00f vlog95: Report that array ports are not supported. 2014-04-10 14:20:22 -07:00
Stephen Williams 3a77537ed8 Handle scaled time is acc functions for non-scope objects
The tf_igetlongtime function may pass in any kind of object, so the
scale() function may need to convert an object handle to the handle
for the objects parent scope.
2014-04-08 11:11:49 -07:00
Stephen Williams c8b20da4be Merge pull request #21 from toddstrader/master
package imports in module headers
2014-04-07 14:09:50 -07:00
Stephen Williams 97e1151388 Merge branch 'x-mil13' 2014-04-07 11:06:54 -07:00
Stephen Williams e6b394f825 Fix declaration of acc_fetch_paramtype 2014-04-07 09:24:30 -07:00
Stephen Williams f752007e9c Add some minor VPI/ACC fixes and updates
These were submitted.
2014-04-06 15:54:05 -07:00
Stephen Williams 40b36337e2 Fix some bugs with packed array dimensions.
The netparray_t::slice_dimensions bug was the most insidious and
caused all manner of confusion. Also fix some other packed array
and unpacked array (and mixed) indexing calculations.
2014-04-06 08:40:10 -07:00
Stephen Williams df4889ba3d Handle SEL_IDX_UP is some situations. 2014-04-06 08:40:09 -07:00
Stephen Williams 2e2317b7c7 Generalize the hname_t to handle n-dimensional scope arrays.
... Not that they actually exist yet. But this fixes some symbol
search issues and makes room for this support in the future.
2014-04-06 08:40:09 -07:00
Stephen Williams e2bad56a5c Fix overflow calculating packed offset in certain cases. 2014-04-06 08:40:09 -07:00
Stephen Williams 0accab6ec4 Handle non-overlapping assignments to unpacked arrays. 2014-04-06 08:40:09 -07:00
Stephen Williams e55e832ea0 Handle unpacked arrays as output ports. 2014-04-06 08:40:09 -07:00
Stephen Williams fc1f9ac6a5 Handle unpacked arrays as module input ports. 2014-04-06 08:40:09 -07:00
Stephen Williams 6caa41cc93 First pass at support for continuous assign of unpacked net arrays. 2014-04-06 08:40:09 -07:00
Stephen Williams 751f19cc46 Symbolic printout of PortType enumeration values. 2014-04-06 08:40:09 -07:00
Stephen Williams f8e33b12cd Clean up pform_module_define_port in preparation for new tricks.
Get rid of the data_type, signed_flag, and range arguments to the
pform_module_define_port because they add no value within the
parse.y parser. Cleaning these out will hopefully ease the addition
of new functionality.
2014-04-06 08:40:09 -07:00
Stephen Williams aaee9989c2 Handle for_variable_declaration
This can be handled entirely in the parser, where we rewrite the
syntax to me a begin/end block that contains the index variable
declaration and the for loop.
2014-04-06 08:40:08 -07:00
Stephen Williams a849249a86 Allow typedefs to override inherited type names. 2014-04-06 08:40:08 -07:00
Todd Strader (todd.strader@gmail.com) 849ba64cf7 package imports in module headers
See IEEE 1800-2012 A.1.2 module_nonansi_header and module_ansi_header
2014-04-03 20:11:57 -04:00
Cary R bb182cf3ce Update cppcheck suppression file. 2014-03-20 18:27:22 -07:00
Martin Whitaker bc9382eea3 Fix for GitHub issue 20 : confused about signed/unsigned in strange ?: example.
The root cause was that NetESignal::dup_exr() was not copying the calculated
type (signed/unsigned) of the expression.

In passing, found and fixed a similar issue when calculating a blended value
for a constant ternary expression.
2014-03-06 19:35:25 +00:00
Stephen Williams 88e4938074 Merge branch 'master' into vec4-stack 2014-03-04 19:08:56 -08:00
Stephen Williams e932c7a637 Support get of vpiIntVal from vec4 stack. 2014-03-04 19:02:21 -08:00
Stephen Williams b5e0099f28 Fix support for enum literals with undefined values. 2014-03-01 17:45:13 -08:00
Stephen Williams 1afe7476e3 Handle nested l-values in vec4-stack code generator. 2014-03-01 16:49:15 -08:00
Stephen Williams 4068570f43 Fix %pow and %pow/s to properly account for 'x operands. 2014-03-01 16:11:47 -08:00
Martin Whitaker 3e41a93f3e Fix for br948 : user-func call may return incorrect value in a CA context.
%exec_ufunc assumed that because a function can never block, a call to
vthread_run() on the function code would only return when the final %end
instruction had been executed. This is not true if the function contains
a named block, which will be executed via a %fork instruction, allowing
the main function thread to suspend after a %join instruction. The fix
is to break %exec_ufunc into two instructions, the first setting the
function inputs and executing the function code, the second collecting
the function result. This provides the opportunity for the parent thread
to suspend after the %exec_ufunc instruction until all its children have
completed.
2014-03-01 23:38:23 +00:00
Stephen Williams 7ceb18fb37 Merge branch 'master' into vec4-stack
Conflicts:
	netmisc.cc
	tgt-vvp/eval_expr.c
	vvp/vthread.cc
2014-03-01 09:02:14 -08:00
Stephen Williams d2ff77d56c More standard handling of unsized numbers as system task arguments. 2014-03-01 08:38:23 -08:00
Stephen Williams 3c660d04f3 Merge pull request #10 from kiteflyingmonkey/patch-1
Fixed homepage link
2014-02-28 19:50:09 -08:00
Cary R d0d421ebe2 Remove compile warning 2014-02-28 17:29:55 -08:00
Cary R 13c1925045 Fix space issue 2014-02-28 17:19:35 -08:00
Martin Whitaker c61d2151c1 Fix invalid optimisations in tgt-vvp.
The vvp code generator was optimising away adds and subtracts where one
operand was a constant zero. This is not valid for 4-state arithmetic.
It was also optimising away multiplies by a constant zero - but in this
case getting it wrong and effectively multiplying by 1.
2014-02-28 23:29:15 +00:00
Martin Whitaker 065c48527c Fix for GitHub issue 19 : incorrect handling of large shift values.
For shift operations evaluated at compile time, the compiler was converting
the right operand to a native unsigned long value. If the operand exceeded
the size of an unsigned long, excess bits were discarded, which could lead
to an incorrect result.

The fix I've chosen is to add an as_unsigned() function to the verinum class
which returns the maximum unsigned value if the internal verinum value is
wider than the native unsigned type. This then naturally gives the correct
result for shifts, as the verinum bit width is also an unsigned value.

I've changed the as_ulong() and as_ulong64() functions to do likewise, as
this is more likely to either give the correct behaviour or to give some
indication that an overflow has occurred where these functions are used.
2014-02-28 20:39:14 +00:00
Martin Whitaker ed2e339dd6 Fix for GitHub issue #18 : undef propagation of const multiplies is incorrect.
When an expression is elaborated, the compiler converts multiplies with
one constamt zero operand into a constant zero value. This is only valid
if the other operand is not a 4-state variable.
2014-02-27 19:30:28 +00:00
Martin Whitaker 5dcd2e8957 Added width cap for unsized expressions.
Unsized expressions can expand to extremely large widths. Usually this
is actually a mistake in the source code, but it can lead to the compiler
temporarily using extremely large amounts of memory, or in the worst
case, crashing. This adds a cap on the width of unsized expressions (by
default 65536 bits, but overridable by the user), and causes a warning
message to be output when the cap is reached.
2014-02-27 19:20:20 +00:00
Martin Whitaker 1f81d4c081 Fix for br947.
When performing the initial assignment for a procedural continuous
assignment, any previous continuous assignment to the destination
signal must be unlinked first, otherwise the initial value for the
assignment will propagate to any other nets that are driven by the
original source signal.
2014-02-26 08:39:33 +00:00
Martin Whitaker a3450bf856 Fixes for GitHub issues 13 and 15.
The verinum arithmetic operators now observe the standard Verilog
rules for calculating the result width if all operands are sized.
If any operand is unsized, the result is lossless, as before.
They also now all observe the standard rules for handling partially
undefined operands (if any operand bit is 'x', the entire result is
'x').

I've also added the unary '-' operator, and renamed v_not() to be
the unary '~' operator. This has allowed some simplification in
other parts of the compiler.
2014-02-25 20:39:21 +00:00
Stephen Williams 91b7c6ab55 Merge branch 'master' into vec4-stack
Conflicts:
	vvp/vthread.cc
2014-02-21 18:04:16 -08:00
Stephen Williams ebed793dec Merge branch 'master' into vec4-stack
Conflicts:
	vvp/vthread.cc

Signed-off-by: Stephen Williams <steve@icarus.com>
2014-02-21 17:34:59 -08:00
Martin Whitaker 320f6d008c Output sorry message for missing procedural assign/force functionality.
A procedural continuous assignment is supposed to be updated any time
a variable on the RHS changes. Currently this only happens if the RHS
is a simple signal.
2014-02-21 23:02:05 +00:00
Martin Whitaker a76be3571d Fix for br946 - procedural continuous assignment causes vvp internal error.
In the case that the RHS of a procedural continuous assignment is a simple
vector that is wider than the LHS, changes to the RHS vector cause the
entire vector to be sent to port 1 of the LHS vvp_fun_signal object. This
vector needs to be coerced to the size of the LHS. Note that this is a
stopgap fix until vvp handles arbitrary expressions on the RHS of a
procedural continuous assignment.
2014-02-21 22:48:50 +00:00
Martin Whitaker 345c9cf21c Implement correct behaviour for signed vector power operations in vvp.
Signed vector power operations were being implemented using the double
pow() function. This gave inaccurate results when the operands or
result were not exactly representable by a 64-bit floating point number.
2014-02-19 20:11:57 +00:00
Martin Whitaker 5a06602af2 Fix for GitHub issue 14 : Bug in processing 1'b1 >= |1'bx.
During expression evaluation, the compiler attempts to optimise away
relational operations when one side is constant and all possible values
of the other side would result in the relation being true. This is not
a valid optimisation if the other side is a 4-state variable, as an
'x' or 'z' will result in the relation being unknown.
2014-02-18 21:22:19 +00:00
Stephen Williams 830083d99b Merge branch 'x-sizer3' 2014-02-16 17:05:53 -08:00
Stephen Williams 6902bf44e3 Improved error handling in parser around typedefs. 2014-02-16 17:04:52 -08:00
Stephen Williams 8f849a9944 Sorry message for unpacked array module ports. 2014-02-16 15:56:32 -08:00