Commit Graph

52 Commits

Author SHA1 Message Date
Stephen Williams c4a62dee0d Pass unsigned-ness of arithmetic operators through operands.
The arithmetic operands are signed only if both operands are signed.
If the expression is unsigned, then the expression as a whole needs
to be processed as unsigned in order to get padding right.
2009-03-11 13:22:11 -07:00
Cary R 3c4b9692a6 Pads and local signal file/line should be related to creation location.
When padding a signal or when creating a local signal the file and
line information should be related to where the new object was
created not the signal value it is being created from.

This patch modifies the NetE* pad_to_width() routines to take a
LineInfo object to set the location to the correct value.

It fixes some set_line() calls to use the correct location.

It fixes ports to not set the file/line information if it is
already defined. Doing this was causing the definition of
signals to become the instantiation instead of the real
module declaration.
2008-11-18 20:24:19 -08:00
Martin Whitaker 610dedc2b8 Fix for pr2146824.
Currently, a bitwise boolean operator will cause the expression
width to be reduced to the size of the result. This can give
rise to incorrect results. This patch changes the behaviour to
take into account the required precision for calculating the
two operands.
2008-10-09 11:33:14 -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
Stephen Williams a33619a0f5 Properly pad results of function calls.
The elaborator improperly allowed user function call nodes to take on
the expression width requested of them. The result was that generated
code had junk pad bits in certain cases.
2008-05-09 15:25:42 -07:00
Cary R 331faa2217 Add signed bit based power to continuous assignments.
This patch adds the power operator for signed bit based values
in a continuous assignment. It also fixes a few other power
expression width problems. The expression width is still not
calculated correctly, since the correct method can produce huge
possible bit widths. The result is currently limited to the width
of the native long. This is because lround() is used to convert
from a double to an integer. A check in the code generator protects
the runtime from this limitation.
2008-02-11 20:06:41 -08:00
Stephen Williams 7975e14b5c LineInfo uses perm_string for path.
Rework the handling of file names to use a perm_string heap to hold
the file names, instead of the custom file name heap in the lexor.
Also rename the get_line to get_fileline to reflect its real duties.
This latter chage touched a lot of files.
2007-12-20 12:31:01 -05:00
Stephen Williams 4c8a7b221c Proper padding of constant bitwise operands
When evaluating bitwise binary expressions at compile time, get the
signed/unsigned padding correct. Pay special attention to the case
of $signed/$unsigned  changing the signedness of the operand.
2007-12-17 21:00:18 -08:00
Cary R 3765f5f421 Do not MSB extend constants that already have a defined width.
During elaboration certain constants were getting extended with
the MSB. This patch makes that happen only if the constant does
not have a length. At this point most should have a length so
effectively every unsigned value is extended with 0.
2007-11-18 19:29:09 -08:00
Cary R 7bba276a79 Propagate sign for constant numbers inside $signed()/$unsigned().
The sign information from $signed() or $unsigned() was not being
propagated correctly for constant numbers.
2007-10-10 20:27:30 -07:00
steve 91d84e7dc7 Major rework of array handling. Memories are replaced with the
more general concept of arrays. The NetMemory and NetEMemory
 classes are removed from the ivl core program, and the IVL_LPM_RAM
 lpm type is removed from the ivl_target API.
2007-01-16 05:44:14 +00:00
steve c339dc4bbc Remove last bits of relax_width methods, and use test_width
to calculate the width of an r-value expression that may
 contain unsized numbers.
2006-11-04 06:19:24 +00:00
steve 2302693201 Expression widths with unsized literals are pseudo-infinite width. 2006-10-30 05:44:49 +00:00
steve 49b65e86fe Add support for power in constant expressions. 2006-07-31 03:50:17 +00:00
steve 044da54b41 Be more stubborn about widths. 2006-05-02 04:29:42 +00:00
steve 0e044d6684 More precise about r-value width of constants. 2005-11-26 00:35:42 +00:00
steve 7796c8bcfb Parameters cannot have their width changed. 2005-05-17 20:56:55 +00:00
steve dfb7c7ba6f Remove the NetEBitSel and combine all bit/part select
behavior into the NetESelect node and IVL_EX_SELECT
 ivl_target expression type.
2005-01-24 05:28:30 +00:00
steve 7c1401a2ba Spelling patch. 2003-08-28 04:11:17 +00:00
steve bfe31e22bf Start handling pad of expressions in code generators. 2003-07-26 03:34:42 +00:00
steve 61195c5daa Harmless fixup of warnings. 2003-06-21 01:21:42 +00:00
steve 71a404a546 Add arithmetic shift operators. 2003-06-18 03:55:18 +00:00
steve 7e2848b105 Do not try to set constants to width 0. 2003-05-20 15:05:33 +00:00
steve d958fd2c36 Fix truncation of signed constant in constant addition. 2003-05-04 20:04:08 +00:00
steve 6fcbc0e59a Fix xz extension of constants. 2003-04-02 04:25:26 +00:00
steve 589422b505 Real constants have no defined vector width 2003-02-06 17:50:23 +00:00
steve 1a9ab8ec84 Remember to save signedness of number. 2003-01-26 21:02:21 +00:00
steve cd7378ff3f Do not truncate high bits of right shift. 2002-11-13 03:03:08 +00:00
steve de94d09706 No need to keep excess width from an
unsigned constant value, if it can
 be trimmed safely.
2002-11-06 02:25:13 +00:00
steve 52bf4e613f conditional ident string using autoconfig. 2002-08-12 01:34:58 +00:00
steve 8667b9a35d Put off evaluation of concatenation repeat expresions
until after parameters are defined. This allows parms
 to be used in repeat expresions.

 Add the builtin $signed system function.
2002-05-05 21:11:49 +00:00
steve c6035ab06e If the verinum is already right, no need to reset it. 2002-04-27 04:49:27 +00:00
steve f28f5e01e5 Unary reduction operators are all 1-bit results. 2001-11-19 04:26:46 +00:00
steve becc7cb56a Handle part select expressions as variants of
NetESignal/IVL_EX_SIGNAL objects, instead of
 creating new and useless temporary signals.
2001-07-27 04:51:44 +00:00
steve b825f8d2b2 Create a config.h.in file to hold all the config
junk, and support gcc 3.0. (Stephan Boettcher)
2001-07-25 03:10:48 +00:00
steve d78c7392c2 Remove dead code. 2001-02-08 01:10:30 +00:00
steve 2fbc0af1ea Fix expression widths for rvalues and parameters (PR#131,132) 2001-02-07 21:47:13 +00:00
steve 6c4b5cf2c2 Fix sign extension of evaluated constants. (PR#91) 2001-01-27 05:41:48 +00:00
steve 4febf5801b Handle width expansion of shift operators. 2000-06-18 03:29:52 +00:00
steve fbe475ef7d Add infrastructure for system functions, move
$time to that structure and add $random.
2000-05-04 03:37:58 +00:00
steve 2b40c7ce11 integer division in expressions properly get width. 2000-04-28 18:43:23 +00:00
steve 906c7b4783 Do not set width too small to hold significant bits. 2000-04-26 03:33:32 +00:00
steve 9a36dcd33d Many Unary operators have known widths. 2000-04-21 02:46:42 +00:00
steve b734ecf02f Macintosh compilers do not support ident. 2000-02-23 02:56:53 +00:00
steve aa8908c52f Multiplication all the way to simulation. 2000-01-13 03:35:35 +00:00
steve 65e4e9f428 Properly expand/shrink constants in expressions. 2000-01-01 19:56:51 +00:00
steve 4d8c0c79d6 Add support for reduction NOR. 1999-10-05 06:19:46 +00:00
steve a7f48c86e2 Relaxed width handling for <= assignment. 1999-10-05 04:02:10 +00:00
steve 0fb4ba7907 Allow expanding of additive operators. 1999-09-29 00:42:50 +00:00
steve 1a21d2fe9d Support shift operators. 1999-09-23 03:56:57 +00:00