Commit Graph

486 Commits

Author SHA1 Message Date
Stephen Williams d4c62309eb Treat assignment into a task port exactly like blocking assignment.
Reuse the code that the blocking assignment uses. This fixes makes
the task port input assignment work better.
2008-12-09 21:52:15 -08:00
Cary R e8b4c5be85 Check for too few buf/not port expressions.
This patch adds code to check that buf and not primitives have
at least two port expressions. An error message is printed for
this case.
2008-12-08 21:04:30 -08:00
Stephen Williams d272a93a40 Case statements need their expresions probed.
Probe the widths of the case statement expressions. The expressions
are self-determined in that context, but the probe is needed to
setup the expression types.
2008-11-29 20:38:40 -08:00
Stephen Williams 69726a56b0 More self-determined expressions need width probed.
Find and fix some more expressions that are self-determined, that
nevertheless need their widths probled.
2008-11-28 11:24:42 -08:00
Stephen Williams bd754b24f4 Support direct nesting of conditional generate schemes.
Verilog generate schemes support a special case where conditional
generate schemes that contain only a nested conditional generate
scheme do not create a new scope. Instead, it relies on the nested
generate scheme to generate the scope.
2008-11-27 19:45:22 -08:00
Stephen Williams 90bfebd578 During test_width is not the time to assert on no_type
unary expressions that have problems should not assert in the
test_width method. Instead, let the error propagate back and be
handled during expression elaboration. This found a few places
where expression widths/types weren't probed before elaboration.
2008-11-26 15:37:38 -08: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
Larry Doolittle e0a1b41b37 Correct and enhance some debug_elaborate messages
Make port number self-consistent, starting at 1.
Add messages marking the start and stop of recursive elaboration.
2008-11-16 18:01:23 -08:00
Larry Doolittle 1d41037009 Avoid crash with typo in varaible name
A simple typo in the rhs of an expression would crash the compiler.
Example:

module crash3;
reg clk;
integer cnt1=0;
always @(posedge clk) begin
        cnt1 <= (cnt==81) ? 0 : (cnt1+1);
end
endmodule
2008-11-14 22:29:09 -08:00
Cary R c278b4e41f Add support for arrayed instances with inout ports.
A NetTran (TRAN_VP) can be used to connect arrayed instance inout
ports. This allows bi-directionality and conflict resolution.
2008-11-14 22:13:41 -08:00
Martin Whitaker 04377151bc Checks for illegal use of automatically allocated variables.
This patch adds a number of compile and run-time checks for illegal
uses of variables declared in automatic tasks and functions. It
also adds a check for event expressions in automatic tasks that use
features not yet supported in VVP.
2008-11-11 20:45:19 -08:00
Stephen Williams ddb2c60701 Remove svector class from Module.h
The goal is to completely remove the svector class because the standard
vector class works perfectly well. This removes the uses in the Module.h
header file.
2008-11-02 20:08:38 -08:00
Stephen Williams b20019d8b6 Merge branch 'master' into verilog-ams 2008-11-01 21:09:29 -07:00
Martin Whitaker 18edf2f15f Rework of automatic task/function support.
This patch splits any VVP net functor that needs to access both
statically and automatically allocated state into two sub-classes,
one for handling operations on statically allocated state, the
other for handling operations on automatically allocated state.
This undoes the increase in run-time memory use introduced when
automatic task/function support was first introduced.

This patch also fixes various issues with event handling in automatic
scopes. Event expressions in automatic scopes may now reference either
statically or automatically allocated variables or arrays, or part
selects or word selects thereof. More complex expressions (e.g.
containing arithmetic or logical operators, function calls, etc.) are
not currently supported.

This patch introduces some error checking for language constructs
that may not reference automatically allocated variables. Further
error checking will follow in a subsequent patch.
2008-10-29 20:43:00 -07:00
Stephen Williams 5aa810dde7 Infrastructure for elaborating analog statements.
Put together the infrastructure for elaborating analog statements,
including create the NetAnalogTop objects that hold analog statements
and are in turn held by the design.

While doing this, clean up the various unique initial/always enumerations
to use the ivl_process_type_t type.
2008-10-21 22:15:49 -07:00
Larry Doolittle 365960df9d Spelling fixes
No code changes.
2008-10-21 19:55:19 -07:00
Martin Whitaker cb2ed9210c Fix for pr2169870.
This patch fixes a bug which prevented storage being allocated for
automatic tasks that had no input or output parameters.
2008-10-16 21:06:38 -07:00
Larry Doolittle f3cb18343a Conditional test width
Add the test_width call for PCondit expr_
Very similar to commit 5fdd9d8339
2008-10-16 21:00:36 -07:00
Cary R c6a5a43620 Fix port signedness calculation.
This fixes the sign calculation for port padding. It also reports if
the padding will be signed or not in the warning message. The inout
calculation may not be correct. It requires both the signal and the
port to be signed, but inout is not currently padded anyway.
2008-10-16 20:55:09 -07:00
Stephen Williams 1a3e655285 Merge test_width rework
This collection of patches fixes a variety of bugs with the handling
of signed-ness in exprsesions.
2008-10-13 20:23:50 -07:00
Larry Doolittle 3adcbb5611 Shadow reduction part 2
Continue cleaning up shadowed variables, flagged by turning on -Wshadow.
No intended change in functionality.  Patch looks right, and is tested
to compile and run on my machine.  No regressions in test suite.
2008-10-13 20:12:47 -07:00
Stephen Williams c85eff93f2 The test_width methods scan and mark expressions with type and size.
Later passes need the intermediate results for width and size so that
some special cases, were self-determined arguments occur, can be
processed properly during elaboration. This can be especially tricky
and interesting for ternary expressions.
2008-10-10 20:42:07 -07:00
Martin Whitaker 082e06edb0 Remove checks for constant expressions from the parser.
This patch removes all the checks for constant expressions performed
during the parsing phase, as these checks are (mostly) repeated during
elaboration. It adds the missing check in the elaboration phase (the
RHS of a register initialisation), and improves the error reporting
and error recovery in other checks.

This patch fixes pr2132552, which was caused by a fault in the parser
constant expression checking.
2008-10-09 11:11:32 -07:00
Stephen Williams 5cfe47da2b Don't try to shrink a valid r-vlaue width.
In assignments, the expression width may be defined by the width of
operands, and not that of the l-value. Choose whichever is creater and
set (or pad) the expression to that width.
2008-10-04 21:44:10 -07:00
Cary R 5fd3be570e Pad input and output ports correctly.
This patch pads inputs and output ports correctly when the port
and the port expression have different widths. It does not fix
inout ports.

It also sets the file and line number information in the unsigned
pad_to_width() routine.
2008-10-03 17:40:05 -07:00
Stephen Williams aebd9c2bc7 Sign extend r-values that refuse to pad themselves.
There are cases where the r-value doesn't pad itself to the width
that is requested by the call to elaborate_expr. This impacts the
elaboration of PGAssign. Pad/sign extend as appropreate.
2008-10-02 22:02:35 -07:00
Stephen Williams 2251844124 Merge branch 'master' into expression-width-rework 2008-09-28 21:21:41 -07:00
Martin Whitaker 7ebcc6b357 Support for automatic tasks and functions.
This patch adds support for automatic tasks and functions.
Refer to the overview in vvp/README.txt for details.
2008-09-27 15:51:16 -07:00
Stephen Williams 3296b1dee3 Include a calculation of the expression type in test_width methods.
The type of the sub-expression is sometimes needed by clients of the
test_width methods, so add that as an output.
2008-09-26 22:20:11 -07:00
Stephen Williams 42d412c626 Unify all the r-value elaboration.
R-value expression elaboration happens in several places. Factor out
the common code so that they are all handled correctly and uniformly.
2008-09-25 21:22:21 -07:00
Stephen Williams ce7dd6b4ff Account for real type l-values when working with widths.
Widths of real values are always 1. When paired with vectorable types
in expressions, the vectorable type is processed as losslessly self-
determined. ("unsized" in the test_width methods.)
2008-09-22 21:09:06 -07:00
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 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
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
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
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
Cary R 3982781e97 Add cast to remove warning. 2008-09-09 19:24:14 -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 5f0b723534 Merge branch 'master' into elaborate-net-rework 2008-09-03 19:59:31 -07:00
Cary R 7beb059d90 Add blocking repeat event control, make repeat sign aware
This patch adds blocking repeat event controls and also makes the
base repeat statement sign aware. If the argument to repeat is
negative (it must be a signed variable) then this is treated just
like an argument of 0 (there is no looping). Doing this allows us
to model the repeat event control as follows.

  lhs = repeat(count) @(event) rhs;

is translated to:

  begin
    temp = rhs;
    repeat (count) @(event);
    lhs = temp;
  end

This patch also pushes the non-blocking event control
information to the elaboration phase where it will report they
are not currently supported.
2008-09-03 19:35:54 -07:00
Stephen Williams 468f45b4db Merge branch 'master' into elaborate-net-rework 2008-08-28 18:17:24 -07:00
Cary R 8c38872b4b Fix the always zero delay check to happen after elaboration.
This patch moves the always zero or possibly zero delay checks
to a point after the circuit is full elaborated. Before it
could try to check tasks that had not already been evaluated
resulting in a crash.
2008-08-28 17:49:41 -07:00
Larry Doolittle b455f3af5d Spelling fixes
Comments only, no code changes
2008-08-28 17:36:32 -07:00
Stephen Williams b2b0f45473 Use the expression with to calculate expression width in assignments.
In continuous assignment, the width of the expression needs to come
from the expression itself, and not just from the width of the l-value.
Use the PExpr::test_width method to get the width of the expression
to pass to the elaborate.
2008-08-26 21:33:24 -07:00
Stephen Williams 04d49fcf35 Merge branch 'master' into elaborate-net-rework 2008-08-21 18:11:21 -07:00
Stephen Williams e18eb32d8b Process shift by constant amounts early in expression elaboration.
The expr:::synthesize methods need not deal with saturating left or
right shifts if they are dealt with early, in elaborate_expr methods.
So the elaborate_expr for shift takes on much more responsibility.
2008-08-20 21:47:07 -07:00
Stephen Williams 0de2dcb211 Allow elaborate_expr to handle implicit nets.
When the elaborate_expr code is used for expressions of continuous
assignments, it needs to be able to create implicit nets.
2008-08-17 08:22:42 -07:00
Stephen Williams 1ae2c0c9e0 Extra diagnostic details in elaboration of continuous assignment. 2008-08-15 21:19:04 -07:00
Cary R 1f5b11246e Correctly pass a concatenation elaboration error.
Because Icarus tries to elaborate as much as it can even after
an error has occurred we need to check for these errors during
elaboration. This patch prevent an undefined identifier from
crashing the compiler.
2008-08-15 17:26:08 -07:00
Stephen Williams 61b9c5e069 Pad signed expressions in continuous asignments
When the continuous assignment is signed, then sign-extend the r-value
in the few cases where the expression is stubbornly smaller then the
desired width.
2008-08-14 20:38:34 -07:00