Commit Graph

6709 Commits

Author SHA1 Message Date
Stephen Williams 8fa79ceb30 Properly implement import <pkg>::<name>
This was temporarily implemented to just copy definitions to the
local scope, but the better method is to create a PEIdent that has
the package attached to it.
2013-02-17 17:00:15 -08:00
Stephen Williams 60cb78e4ab Add packages and their own scope.
This makes <pkg>::<name> work properly, and also makes the
package descriptions available through VPI.
2013-02-17 17:00:15 -08:00
Stephen Williams 97f3a01dc5 Support import if single items. 2013-02-17 16:59:21 -08:00
Stephen Williams 99b8086ad2 Import parameters from packages. 2013-02-17 16:59:21 -08:00
Cary R c4386da666 vlog95: Emit initial blocks for tasks or functions.
In SystemVerilog a task or function can initialize a variable in a task or
function. In Icarus this is done by creating an initial block that does
the assignment. We can translate this by emitting the initial block in the
enclosing module scope. This is not 100% correct since SystemVerilog
requires the initialization to be done before the other initial/always
blocks are processed. For SystemVerilog the current Icarus behavior is
incorrect, but even if it had a new process type that ran before the other
ones the best I can do for vlog95 is emit it before the normal module
processes which currently works.
2013-02-15 19:43:32 -08:00
Cary R 51112131ad vlog95: Emit if using signed and add the number of errors to the output
In the starting comment say if the conversion was done with signed support.
If there were errors then add a comment at the end of the file that says
how many errors occurred and add a line after this that prevents the file
from running with out an error. This requires the user to see that errors
occurred and remove the offending line if they want to use the file anyway.
2013-02-15 19:43:19 -08:00
Cary R 8808cd9514 For a LPM constant pass the sign information and one other fix
For a LPM constant we need to pass the sign information so that the vlog95
code generator can create the correct constant. Also when using the
sub_net_from() routine the numeric constant should have the same sign as
the signal so that it can also be displayed correctly.
2013-02-15 11:59:25 -08:00
Cary R 890589191c When duplicating a select keep the sign information
Make the duplicate select signed if the original was signed.
2013-02-14 18:57:31 -08:00
Cary R 28bc333cba vlog95: block generating a concat-Z LPM device in the compiler.
Since the vlog95 code generator needs the strength information we do
not want to hide it behind a concat-Z optimization. For now we abort
the optimization, but in the future we could add parts of this back
in (e.g. all the drivers have matching strength then replace with a
normal concat and a buf-Z if the strength are not both strong. The
original buf-Z should be removed to reduce the number of LPM devices).
2013-02-13 19:19:21 -08:00
Cary R 8b4dc05ff8 vlog95: for a part/pv look for the strength at the driver
A part/pv passes strength information so we need to use the real driver
to get the appropriate drive information.
2013-02-12 19:38:28 -08:00
Cary R 6de80adbe8 Fix space issue 2013-02-12 18:38:33 -08:00
Cary R fdcef3cbc4 A concatenation may also need a BUFZ to hold the drive strength
Just like a select a concatenation needs a BUFZ to hold the drive strength.
2013-02-12 18:36:39 -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 1929cfc4f9 Fix space issues 2013-02-08 11:24:11 -08:00
Martin Whitaker 8b70fefa59 Refactor eval_tree debug code.
This just pulls the eval_tree debug message generation into one place.
2013-02-08 11:22:49 -08:00
Martin Whitaker af91920a17 Add support for system function calls in constant functions. 2013-02-08 11:19:26 -08:00
Martin Whitaker 89244e0f70 Add support for concatenation operations in constant functions.
Also fix a compiler crash when attempting to evaluate a function
which has no valid statement(s) (due to earlier compilation errors).
2013-02-08 11:19:17 -08:00
Cary R 5abd939655 vlog95: fix bug in min/max translation code 2013-02-08 11:18:49 -08:00
Cary R 06ce23d9c2 vlog95: Add support for Verilog-A abs(), min(), max() and some SV types.
The Verilog-A abs(), min() and max() functions can be converted if the
expressions do not have side effects. Also note the new, null and class
property operators from SystemVerilog are not supported.
2013-02-07 19:53:10 -08:00
Cary R a581e0ef0e vlog95: Report zero argument functions are not supported. 2013-02-07 17:08:59 -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 dc387ad9d1 vlog95: Add a messge that ** (power) is not supported in a CA. 2013-02-07 10:21:04 -08:00
Cary R 48b186576e Report in SV that Icarus cannot currently call a function like a task.
SystemVerilog allows a function to be called without an assignment for
the return value. This patch adds a warning that Icarus does not currently
support this and provides a place to add this functionality later.
2013-02-06 12:41:42 -08:00
Cary R 15b0946fc4 vlog95: Add support for the new CONCATZ LPM type. 2013-02-06 10:05:12 -08:00
Cary R 5830e65829 Fix space issues. 2013-02-04 12:17:41 -08:00
Martin Whitaker f3a51fdfd1 Factor out some common eval_tree code.
The eval_tree() function is identical in most of the NetEBinary and
NetEUnary sub-classes.
2013-02-04 12:17:29 -08:00
Martin Whitaker afd23d13d5 Add support for unary operators in constant user functions.
This patch implements the evaluate_function method for the NetEUnary
and NetEUReduce classes.
2013-02-04 12:17:05 -08:00
Martin Whitaker 11f479e028 Add support for all binary operators in constant user functions.
This patch implements the evaluate_function method for the NetEBBits,
NetEBDiv, NetEBLogic, NetEBMinMax, and NetEBPow classes. It also
factors out some common code into the NetEBinary class.
2013-02-04 12:16:51 -08:00
Cary R 838f6ce862 Minor fixes to br916 patch. 2013-02-04 11:45:22 -08:00
Martin Whitaker e99d53b80b Stopgap fix for br916.
Currently, when a variable expression is passed to a system task,
the expression value is stored in thread memory. Values stored
in thread memory cannot safely be passed to $strobe or $monitor,
because the thread memory may get reused or deallocated before
the $strobe or $monitor task actually executes. As a temporary
measure, we just trap this case and terminate with a "sorry"
message. A proper fix would require the expression value to be
calculated at the time the $strobe or $monitor executes, not at
the time it is called.
2013-02-04 11:45:11 -08:00
Stephen Williams 1d314faf97 bool .net8 objects?
This is rather a pointless sort of thing, but it does turn from
from time to time, for example when constant literals (with no x or
z bits) are given strengths. So handle .net8/2s and .net8/2u the
same as .net8.s and .net8 objects.
2013-02-02 17:38:24 -08:00
Stephen Williams 751587e112 PV-to-concat belnding should use a strength-aware concat. 2013-02-02 10:44:16 -08:00
Stephen Williams 673675fecd Properly handle class properties what are wider then native.
Fix a bug where if a class property were wider then a native long
it would get truncated.
2013-01-31 18:13:36 -08:00
Stephen Williams ee58fd749c Merge branch 'x-mil6' 2013-01-30 17:03:19 -08:00
Cary R bcc7973792 Update LDFLAGS usage in tgt-pal and tgt-pcb to match the other directories 2013-01-29 17:28:42 -08:00
Martin Whitaker b176a6410d Fix logic value returned for unambiguous HiZ1 strength.
If a strength aware net has an unambiguous HiZ1 strength, VVP treats
it as a logic '1'. It should be treated as a logic 'z'. An ambiguous
HiZ1/HiZ0 strength should also be treated as a logic 'z'.
2013-01-28 19:06:59 -08:00
Stephen Williams d8592b1444 Allow for class objects an class properties. 2013-01-27 20:10:25 -08:00
Stephen Williams 4568766cff Add support for darrays as class properties. 2013-01-27 20:10:25 -08:00
Stephen Williams c49b21115a Handle strings as class object properties.
While we are at it, fix a handling of null strings in
string expressions.
2013-01-27 20:10:25 -08:00
Stephen Williams 106850ca7d Handle real value class properties.
As a side effect, this also adds support for 64bit integers.
2013-01-27 20:10:25 -08:00
Stephen Williams 2ea5919a4a Get signed-ness of property correct in certain situations. 2013-01-27 20:10:25 -08:00
Stephen Williams 0375ff3923 Handle some different integral types is class properties. 2013-01-27 20:10:25 -08:00
Cary R 59ce217ce2 vlog95: Add support for undefined selects. 2013-01-25 12:46:55 -08:00
Cary R 350369f3fc Handle undefined L-value selects
L-value bit selects were incorrectly converting an undefined index to 0.

L-value part selects were asserting if an undefined index was given.

This patch unifies how all these are handle (including indexed part selects).

The base is set to an undefined value and an appropriate width is used.
A warning message is always printed since this is not a simple out of
range issue. It is the responsibility of the code generator to skip the
assignment, but we always want to execute the R-value since it could have
a side effect.
2013-01-25 10:32:36 -08:00
Cary R d9c400ac0c A scope port can be a uwire for some cases. 2013-01-24 18:28:04 -08:00
Cary R 922b74be9e Fix uninitialized buffer when drawing a real VPI argument 2013-01-22 09:22:50 -08:00
Martin Whitaker cd239a9857 Fix display of net array words when data type is signed.
When VVP compiles a .array statement for a net array, it does not
know the data type, so initialises the array signed_flag to false.
We need to set the signed_flag to the correct value once we know
the data type, to allow the VPI routines to correctly format the
data.
2013-01-21 18:46:48 -08:00
Cary R 8e515a9a64 Merge branch 'master' of github.com:steveicarus/iverilog 2013-01-11 15:10:17 -08:00
Martin Whitaker 45bb1313e7 Correctly handle negative genvar values.
During expression elaboration, genvar values were being erroneously
cast to unsigned values when creating a verinum for use in expression
evaluation.
2013-01-11 15:09:20 -08:00
Stephen Williams d04aa4b234 Merge branch 'master' of github.com:steveicarus/iverilog 2013-01-05 16:40:14 -08:00