Commit Graph

502 Commits

Author SHA1 Message Date
Cary R fe72d02cf6 Major rework of the ternary operator elaboration code.
This patch reworks much of the ternary code to short circuit when
possible and supports real values better. It adds a blend operator
for real values that returns 0.0 when the values differ and the value
when they match. This deviates slightly from the standard which
specifies that the value for reals is always 0.0 when the conditional
is 'bx. There are also a couple bug fixes.

These fixes have not been ported to continuous assignments yet.
Ternary operators used at compile time and in procedural assignments
should be complete (short circuit and support real values).
2008-03-08 19:45:13 -08:00
Stephen Williams 32a2e7aa39 Fix lexical scopes within case-generate alternatives.
Case-generate alternatives create sub-scopes that need to be scanned
by the scope scanner in order to get function definitions etc. that
are defined lexically within generated scopes.
2008-03-02 21:04:04 -08:00
Cary R fac1cc5a1c Add user function synth and clean up expression code.
This patch adds synthesize() for user functions. It also cleans up a
number of inconsistencies and missing checks in the expression code.
2008-02-24 20:00:18 -08:00
Stephen Williams 11a33a0907 Merge branch 'pscope' 2008-02-24 19:45:21 -08:00
Stephen Williams 8e704cbf93 Rework handling of lexical scope
Move the storage of wires (signals) out of the Module class into
the PScope base class, and instead of putting the PWires all into
the Module object, distribute them into the various lexical scopes
(derived from PScope) so that the wire names do not need to carry
scope information.

This required some rewiring of elaboration of signals, and rewriting
of lexical scope handling.
2008-02-24 19:40:54 -08:00
Cary R 3716e972ec Add support for unary +/- in real parameter evaluation.
This patch adds support for unary + and - of real value constants
to the eval_tree() functionality.
2008-02-20 17:24:44 -08:00
Stephen Williams f1f2806e3c Get delays of signed extended continuous assignments right.
Padding and continuous assignment caused problems if the continuous
assignment includes a delay. The problem is that the padding was
not necessarily included in the delay. Rework the elaboration to
make sure the padding is indeed included in the delay.
2008-02-01 20:13:23 -08:00
Cary R 5e8a1bd8cc Add power operator (**) for real values in a continuous assignment.
This patch adds the power operator for real values in a continuous
assignment.
2008-01-31 16:48:52 -08:00
Larry Doolittle d9ac146b8f Spelling fixes
only comments and documentation
some punctuation and capitalization for good measure
Changelogs are purposefully untouched
2008-01-29 20:24:24 -08:00
Stephen Williams abfccb65e9 User defined functions take real arguments
Allow user defined functions to take real value arguments and return
real value results in net contexts. Use the data type of the nets
attached to the ports to define the data types of the arguments and
return value.
2008-01-28 18:57:55 -08:00
Larry Doolittle 47d65034db Spelling fixes
mostly comments, but includes some identifiers and message text
2008-01-27 18:18:13 -08:00
Stephen Williams 76164d7711 Rework compile-time evaluation of LT and GT
There was much redundant code in the compile-tile handling of the
less-then and greater-then of constant expressions, and much of it
was buggy. Unify much of the code and squeeze out the bugs so that
compile-time evaluations come out correctly.
2008-01-23 20:43:13 -08:00
Stephen Williams 1f7957c612 Fix type handling of real-value system functions in nets
In nets, if system functions return a real value the function lookup
was getting the correct width, but was also setting the width to 0,
which confused down-stream net handling. Real-value system fuctions
have a width of 1. (1 real-valued scalar.)
2008-01-08 18:54:55 -08: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 088b4e2fb8 Fix function/task scope searching.
When looking for a function or task (scope) do not compare the final path
component with the current module name since it cannot be an up reference.
2007-12-07 17:57:26 -08:00
Martin Whitaker dd56dd1635 Correct naming of unnamed generate blocks.
This patch causes unnamed generate blocks to be automatically named
using the naming scheme defined in the Verilog-2005 standard. This
is a fix for the problem discussed in pr1821610.
2007-11-18 21:01:35 -08:00
Cary R dbce0cb05a Fix @* to correctly handle non-input nets.
@* was only expanding to input nets. nex_input() for blocks was removing
any output net that was also an input. There was also a bug in how output
nets were removed. Only outputs currently defined were removed from the
input list.

always @(*) begin
  y = a;
  z = y;
end

would report "a" as an input. While

always @(*) begin
  z = y;
  y = a;
end

would report both "a" and "y" as inputs.

To fix this all nex_inputs now take a flag that when true (the default)
correctly removes any output from the input list. Both the above cases
will now return "a". If the flag is false outputs which are also inputs
will be included in the input list. This is what the @* elaboration code
uses to get the correct sensitivity list.
2007-11-07 20:00:05 -08:00
Cary R 7c852aa075 Add cmos/rcmos primitives.
This patch adds the cmos and rcmos primitives.
2007-09-06 18:46:22 -07:00
Cary R 4f6b47b345 Check that functions do not call invalid statements.
This patch adds checks to verify that functions do not invoke
statements that are invalid for them (#, @, wait, enable/call
tasks and non blocking assignment). For reference see section
10.3.4 of 1364-2001.
2007-08-30 20:41:45 -07:00
Stephen Williams 5e385e901d Fix missing endif 2007-08-10 10:14:00 -07:00
Stephen Williams 3b94c122b7 Constant concat operands are self determined
distinguish between self-determined and value-preserving when
evaluating constants that are arguments to concatenations.

Signed-off-by: Stephen Williams <steve@icarus.com>
2007-08-09 22:08:54 -07:00
Stephen Williams 845e74c30e Evaluate parameter expressions losslessly
Make sure parameter expressions are evaluated losslessly, as if
the l-value is unsigned and thus virtually infinite.
2007-06-27 22:05:36 -07:00
steve c7d97f4146 Properly evaluate scope path expressions. 2007-06-02 03:42:12 +00:00
steve ddd36ecb6c Rework the heirarchical identifier parse syntax and pform
to handle more general combinations of heirarch and bit selects.
2007-05-24 04:07:11 +00:00
steve b981c81d37 Rework hname_t to use perm_strings. 2007-04-26 03:06:21 +00:00
steve 583abb7f49 Fix handling calls to tasks in combinational always block 2007-04-17 04:34:23 +00:00
steve 33e5f22cf1 Handle evaluate of addition of real valued constants. 2007-04-07 04:46:18 +00:00
steve d883979fd8 Seperate arrayness from word count 2007-04-02 01:12:34 +00:00
steve fe8da0bf14 Remove pretense of general use for t_cookie. 2007-03-26 18:17:50 +00:00
steve 611d2c81b3 Spelling fixes from Larry 2007-03-22 16:08:14 +00:00
steve d9efe3312e Limit the calculated widths of constants. 2007-03-08 05:30:02 +00:00
steve fc9a90c9e0 Add support for edge sensitive spec paths. 2007-03-02 06:13:22 +00:00
steve 243cf94165 Add support for conditional specify delay paths. 2007-03-01 06:19:38 +00:00
steve 1f54f128c1 Handle unary minus of real valued expressions. 2007-02-20 05:58:36 +00:00
steve 45307f6144 Handle type of ternary expressions properly. 2007-02-14 05:59:46 +00:00
steve 6d91be5b19 Use inttypes.h instead of stdint.h for portability. 2007-02-02 04:33:00 +00: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 69cd007a71 Support real valued specify delays, properly scaled. 2006-10-03 05:06:00 +00:00
steve b658a3b41f Missing PSpec.cc file. 2006-09-26 19:48:40 +00:00
steve 0edb5a7547 Basic support for specify timing. 2006-09-23 04:57:19 +00:00
steve fc0695beb6 Handle 64bit delay constants. 2006-08-08 05:11:37 +00:00
steve 49b65e86fe Add support for power in constant expressions. 2006-07-31 03:50:17 +00:00
steve 80f30be9d0 Add support for system functions in continuous assignments. 2006-06-18 04:15:50 +00:00
steve f001d0001a Add support for generate loops w/ wires and gates. 2006-04-10 00:37:42 +00:00
steve 5b3ba8c306 Properly handle signedness in compare. 2006-03-18 22:52:27 +00:00
steve d434dd7296 Allow part selects of memory words in l-values. 2006-02-02 02:43:57 +00:00
steve 58f182a159 Node delays can be more general expressions in structural contexts. 2006-01-02 05:33:19 +00:00
steve 908955c72c Handle bit select of parameter with ranges. 2005-11-27 05:56:20 +00:00
steve 0e044d6684 More precise about r-value width of constants. 2005-11-26 00:35:42 +00:00
steve be73be8c98 Spelling patches from Larry. 2005-09-19 21:45:35 +00:00
steve 9fd16575d9 Support bool expressions and compares handle them optimally. 2005-09-14 02:53:13 +00:00
steve c39976fbf1 Generate code to handle real valued muxes. 2005-09-01 04:11:37 +00:00
steve b69f59f2ec Handle memory references is continuous assignments. 2005-08-31 05:07:31 +00:00
steve a8d49921ee gcc4 compile errors. 2005-07-14 23:34:18 +00:00
steve b9799cf6ec Remove NetVariable and ivl_variable_t structures. 2005-07-11 16:56:50 +00:00
steve 75ad90534b Generalize signals to carry types. 2005-07-07 16:22:49 +00:00
steve 739a1839ed Do sign extension of structuran nets. 2005-05-24 01:44:27 +00:00
steve 7796c8bcfb Parameters cannot have their width changed. 2005-05-17 20:56:55 +00:00
steve 7dd0d255a6 Add support for variable part select. 2005-05-08 23:40:14 +00:00
steve 365cfedd55 Update DFF support to new data flow. 2005-04-24 23:44:01 +00:00
steve 800e2c6a17 All memory addresses are signed. 2005-04-08 04:51:16 +00:00
steve 65c7ec00e7 Rework NetRamDq and IVL_LPM_RAM nodes. 2005-04-06 05:29:08 +00:00
steve 53da6e9a33 Add support for LPM_UFUNC user defined functions. 2005-03-18 02:56:03 +00:00
steve ab1ca54df2 Update support for LPM_MOD. 2005-03-12 06:43:35 +00:00
steve 1c5b4881d7 Handle case inequality in netlists. 2005-03-09 05:52:03 +00:00
steve 257e1f9516 Support shifts and divide. 2005-02-19 02:43:38 +00:00
steve d74177634c Restructure NetMux devices to pass vectors.
Generate NetMux devices from ternary expressions,
 Reduce NetMux devices to bufif when appropriate.
2005-02-12 06:25:40 +00:00
steve ee5bb5fcaf Add the NetRepeat node, and code generator support. 2005-02-08 00:12:36 +00:00
steve 97f83ffbe3 laborate reduction gates into LPM_RED_ nodes. 2005-02-03 04:56:20 +00:00
steve e6cdd32c19 Clarify width argument to NetNet constructor. 2005-01-30 01:43:48 +00:00
steve 99ace10774 Simplified NetMult and IVL_LPM_MULT. 2005-01-28 05:39:33 +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 25de448d34 Remove obsolete NetSubnet class. 2005-01-22 18:16:00 +00:00
steve e28636776a Change case compare from logic to an LPM node. 2005-01-22 01:06:55 +00:00
steve bf6a5d0f50 Implement LPM_COMPARE nodes as two-input vector functors. 2005-01-16 04:20:32 +00:00
steve 4d139b58aa Properly pad vector widths in pgassign. 2005-01-12 03:17:36 +00:00
steve 9e94afe399 Use PartSelect/PV and VP to handle part selects through ports. 2005-01-09 20:16:00 +00:00
steve 8f2d679c8a Unify elaboration of l-values for all proceedural assignments,
including assing, cassign and force.

 Generate NetConcat devices for gate outputs that feed into a
 vector results. Use this to hande gate arrays. Also let gate
 arrays handle vectors of gates when the outputs allow for it.
2004-12-29 23:55:43 +00:00
steve 65e9b6be12 Rework of internals to carry vectors through nexus instead
of single bits. Make the ivl, tgt-vvp and vvp initial changes
 down this path.
2004-12-11 02:31:25 +00:00
steve e4ae832153 Clean up spurious trailing white space. 2004-10-04 01:10:51 +00:00
steve 526b87cae3 Remove inaccurate comment. 2004-10-04 00:25:18 +00:00
steve 9de786fc44 Add support for module instance arrays. 2004-09-05 17:44:41 +00:00
steve 62cffe16f4 PR1026: assignment statements can have sensitivities in the l-values. 2004-09-04 04:24:15 +00:00
steve f02f5be3cc Fix use of system tasks in AT_STAR statements. 2004-08-28 16:23:05 +00:00
steve d76ad25778 Do not change reg to wire in NetAssign_ unless synthesizing. 2004-08-28 15:08:31 +00:00
steve efe05a77cb nex_output for NetPDelay statements. 2004-06-30 15:32:18 +00:00
steve 3dbc07f34d Implement signed divide and signed right shift in nets. 2004-06-30 02:16:26 +00:00
steve 9949040285 Add support for the default_nettype directive. 2004-06-13 04:56:53 +00:00
steve 5472b27e1f Rewire/generalize parsing an elaboration of
function return values to allow for better
 speed and more type support.
2004-05-31 23:34:36 +00:00
steve 1295058e5d parameter keys are per_strings. 2004-02-20 06:22:56 +00:00
steve 89acc41437 LPM, logic and Variables have perm_string names. 2004-02-19 07:06:57 +00:00
steve 536068bdfb Memory and Event names use perm_string. 2004-02-19 06:57:10 +00:00
steve 27af95d402 Use perm_strings for named langiage items. 2004-02-18 17:11:54 +00:00
steve 57c3e86084 Debug dumps for synth2. 2003-12-17 16:52:39 +00:00
steve 43f28b53a3 Design::get_flag returns const char* instead of string. 2003-11-10 20:59:03 +00:00
steve bc0ead2842 Spelling fixes in comments. 2003-11-08 20:06:21 +00:00
steve 7fd669fcc0 NetEUReduce has its own dup_expr method. 2003-10-31 02:47:11 +00:00
steve edaa7df6d2 Output of While is output of while substatement. 2003-10-26 04:51:38 +00:00
steve 1f0c274e82 Obsolete find_symbol and find_event from the Design class. 2003-09-20 01:05:35 +00:00
steve 693794552c Remove find_memory method from Design class. 2003-09-19 03:50:12 +00:00
steve da7956a797 Fix name search in elab_lval. 2003-09-19 03:30:04 +00:00
steve 178847fc53 Spelling fixes. 2003-09-13 01:01:51 +00:00
steve 7c1401a2ba Spelling patch. 2003-08-28 04:11:17 +00:00
steve e561819179 Add synthesis support for synchronous reset. 2003-08-15 02:23:52 +00:00
steve a95463ff81 Add support for IVL_LPM_MULT device. 2003-08-09 03:23:03 +00:00
steve bfe31e22bf Start handling pad of expressions in code generators. 2003-07-26 03:34:42 +00:00
steve cadf4cfdef Spelling fixes. 2003-07-15 03:49:22 +00:00
steve 004ecd08dd Elide empty begin-end in conditionals. 2003-07-02 04:19:16 +00:00
steve 61195c5daa Harmless fixup of warnings. 2003-06-21 01:21:42 +00:00
steve ccf4d4d7da Module attributes from the parser
through to elaborated form.
2003-06-20 00:53:19 +00:00
steve 71a404a546 Add arithmetic shift operators. 2003-06-18 03:55:18 +00:00
steve 8352c91b0a Evaluate <= with real operands. 2003-06-05 04:28:24 +00:00
steve 5903f0744c Support parameters in real expressions and
as real expressions, and fix multiply and
 divide with real results.
2003-05-30 02:55:32 +00:00
steve 76295ac873 More complete bit range internal error message,
Better test of part select ranges on non-zero
 signal ranges.
2003-05-01 01:13:57 +00:00
steve f1cc9d865b Support event names as expressions elements. 2003-04-22 04:48:29 +00:00
steve 5d1d99a89f Handle signed magnitude compare all the
way through to the vvp code generator.
2003-04-11 05:18:08 +00:00
steve 2c129dfbfa Synthesize shift expressions. 2003-04-08 04:33:55 +00:00
steve d18934d444 Sign extend NetMult inputs if result is signed. 2003-03-29 05:51:25 +00:00
steve c602d94cef Comparison operators do have defined width. 2003-03-15 18:08:43 +00:00
steve 6d94f2ea55 Better organize the NetESFunc return type guesses. 2003-03-15 04:46:28 +00:00
steve 1222153cdf Keep parameter constants for the ivl_target API. 2003-03-10 23:40:53 +00:00
steve badad63ab4 All NetObj objects have lex_string base names. 2003-03-06 00:28:41 +00:00
steve 486274cfa1 Scope names stored only as basename. 2003-03-03 02:22:41 +00:00
steve 4c67de5ca7 Add the lex_strings string handler, and put
scope names and system task/function names
 into this table. Also, permallocate event
 names from the beginning.
2003-03-01 06:25:30 +00:00
steve f8d1e15a27 NetEBDiv handles real value constant expressions. 2003-02-07 02:47:57 +00:00
steve 589422b505 Real constants have no defined vector width 2003-02-06 17:50:23 +00:00
steve e941e7e805 Spelling fixes. 2003-01-30 16:23:07 +00:00
steve 04ada23119 Support in various contexts the $realtime
system task.
2003-01-27 00:14:37 +00:00
steve 46253ed873 Rework expression parsing and elaboration to
accommodate real/realtime values and expressions.
2003-01-26 21:15:58 +00:00
steve e62e1d89b6 Named event triggers can take hierarchical names. 2002-12-07 02:49:24 +00:00
steve 9f80ed32b6 Support bit select in constant expressions. 2002-12-05 02:14:33 +00:00
steve aa8869a3c7 Postpone parameter width check to evaluation. 2002-11-09 01:40:19 +00:00
steve 86032c0aa5 Allow named events to be referenced by
hierarchical names.
2002-11-02 03:27:51 +00:00
steve 9ce2806710 Fix synth2 handling of aset/aclr signals where
flip-flops are split by begin-end blocks.
2002-10-23 01:45:24 +00:00
steve 3d4593d4d5 Synthesizer support for synchronous begin-end blocks. 2002-10-21 01:42:08 +00:00
steve 43501809b1 Redo the parameter vector support to allow
parameter names in range expressions.
2002-10-19 22:59:49 +00:00
steve 166621bcb3 Generate vvp code for asynch set/reset of NetFF. 2002-09-26 03:18:04 +00:00
steve 879a5a4cbe Synthesize async set/reset is certain cases. 2002-09-26 01:13:14 +00:00
steve eb81062d85 Add to synth2 support for synthesis of
synchronous logic. This includes DFF enables
 modeled by if/then/else.
2002-09-16 00:30:33 +00:00
steve dac99b9374 Add support for binary nand operator. 2002-09-12 15:49:43 +00:00
steve 8ab2ec6f86 Allow release to handle removal of target net. 2002-08-19 00:06:11 +00:00
steve 2fad8d4cff Detect temporaries in sequential block synthesis. 2002-08-18 22:07:16 +00:00
steve c794aa02b8 Fix intermix of node functors and node delete. 2002-08-16 05:18:27 +00:00
steve 52bf4e613f conditional ident string using autoconfig. 2002-08-12 01:34:58 +00:00
steve 693e9e5ad0 Store only the base name of memories. 2002-08-05 04:18:45 +00:00
steve 89314d4772 Do not use hierarchical names of memories to
generate vvp labels. -tdll target does not
 used hierarchical name string to look up the
 memory objects in the design.
2002-08-04 18:28:14 +00:00
steve bb87c368b8 Asynchronous synthesis of sequential blocks. 2002-07-29 00:00:28 +00:00
steve 58ec62c895 Rewrite find_similar_event to support doing
all event matching and replacement in one
 shot, saving time in the scans.
2002-07-24 16:24:45 +00:00