Commit Graph

134 Commits

Author SHA1 Message Date
Cary R 860761f9c6 More cppcheck fixes - part 2 2025-10-20 23:54:15 -07:00
Lars-Peter Clausen d6d95c7c49 Use non-array `NetNet` constructor where appropriate
There are two `NetNet` constructors, one for arrays and one for non-arrays.
There are a few places where the array constructor is used for non-arrays,
but with an empty unpacked dimensions list. Switch this over to using the
non-array constructor.

This slightly reduces boiler-plate code.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-09-09 05:50:25 -07:00
Cary R dc8b7d0184 Cleanup some cppcheck warnings 2022-12-28 00:00:31 -08:00
Stephen Williams 5b9ceee062 Make the for_step of for loops optional
In IEEE Std 1800-2017 A.6.8: the for_step part of the for loop
is optional. If missing, it is assumed that the programmer known
what they are doing.
2022-12-11 16:39:53 -08:00
Stephen Williams 78f37f7156 Handle for loops with empty initialization statement
For loops may have empty initialization statements. In that case some things
can't be done, such as loop unrolling or synthesis, but otherwise it is a
valid thing to do. So generate the correct code in this case.
2022-12-11 15:46:16 -08:00
Lars-Peter Clausen e15b125da8 Replace svector with std::vector
The custom `svector` class is essentially a subset of `std::vector`. There
is no inherent advantage to using `svector`. Both have the same memory
footprint.

`svector` was designed to be of static size, but there are a few places in
the parser where it has to grow at runtime. Handling this becomes a bit
easier by switching to `std::vector` since it is possible to use its
methods which take care of resizing the vector.

This also allows to remove the unused parameter of the `lgate` struct
constructor, which was only needed for compatibility with `svector`.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-05-15 21:56:48 +02:00
Martin Whitaker b7f948193a Report correct net name in synthesis "sorry" message (issue #649). 2022-03-19 12:17:44 +00:00
Martin Whitaker 387d18d222 Fix GitHub issue #306 - segfault when synthesising deassign statement.
Synthesis doesn't properly support any of the procedural continuous
assignment statements, so output a "sorry" message and abort synthesis.
2020-02-09 18:22:58 +00:00
Martin Whitaker 27213f2af8 Fix for GitHub issue #115 - synthesis aborts on case with max guard of 0.
The calculation of the required multiplexer width was incorrect for
the corner case of a single guard value of zero.
2016-07-22 23:09:36 +01:00
Martin Whitaker 708a7d0621 Move some redundant initialisation of bitmasks in synthesis.
These are made obsolete by an earlier bugfix.
2016-03-12 12:02:22 +00:00
Martin Whitaker 22bc798696 Added warning when a latch enable is a synthesised expression. 2016-03-12 11:21:23 +00:00
Martin Whitaker 0e537c5465 Enable latch generation in synthesis.
(reworked patch supplied by Johann Klammer)
2016-03-11 23:29:58 +00:00
Martin Whitaker f176106c54 Added notes on synthesis implementation. 2016-03-11 18:35:13 +00:00
Martin Whitaker c1c4d8c863 Fix bitmask merging in synthesis.
A conditional clause that doesn't drive any bits of a particular nexus
should not affect the bitmask generated for that nexus. The completely
undriven case is handled by the enable signal.
2016-03-11 17:32:12 +00:00
Martin Whitaker 8348c25104 Take heed of disable_concatz_generation flag in mux synthesis. 2016-02-27 16:39:15 +00:00
Martin Whitaker f3cf7ca546 Updated comments for synthesis. 2016-02-21 22:39:52 +00:00
Martin Whitaker f29935d8dd Enhanced support for asynchronous set/reset in synthesis.
Added the ability to coalesce set/reset values to different parts
of the same vector. Also added a check that all bits of the vector
are assigned a value.
Enabled coalescence of asynchronous set/reset part-vectors
2016-02-21 21:46:36 +00:00
Martin Whitaker 5286fb858d Synthesis rework.
Synthesis could only handle relatively simple conditional constructs.
This rework aims to make it handle anything the user can throw at it
(or output a sensible message as to why it can't).
2016-02-21 00:00:39 +00:00
Martin Whitaker 83a82914e0 Temporary fix for br993 - assertion failure in flip-flop synthesis.
Synthesis does not currently support some commonly used styles for
representing flip-flops, e.g.

  q <= 0;
  if (en) q <= 1;

or

  if (clr) q <= 0;
  if (set) q <= 1;

For now, output a "sorry" message.
2016-01-30 22:38:08 +00:00
Martin Whitaker a006dee990 Fix for br994 - assertion failure when synthesising a mux.
The elaborator allows the RHS of assignment to be wider than the
LHS. When using an if statement to represent a mux, this meant the
mux inputs could be different widths, resulting in an assertion
failure during synthesis. The fix is to prune the RHS to match the
LHS for each assignment. This has the benefit of minimising the
mux width.
2016-01-30 20:11:58 +00:00
Martin Whitaker fbeee1bae3 Temporary fix for br995 - assignment to memory not supported in synthesis.
For now, output a "sorry" message.
2016-01-30 17:01:13 +00:00
Martin Whitaker b242663cae Support negedge flip-flops in synthesis and in vvp.
Also extend the support for FF asynchronous set values to vvp and
fix the dff functor in vvp to correctly model asynchronous set/clr
behaviour.
2015-06-13 16:47:57 +01:00
Martin Whitaker d39c284055 Observe and propagate failures when synthesising lval concatenations. 2015-06-13 16:47:57 +01:00
Martin Whitaker e0cdd71984 Minor cleanup and simplification of aset_value changes. 2015-06-08 21:20:49 +01:00
Johann Klammer 81e1735959 establish support for aset_value and reorder clauses so vlog95 doesn't fail anymore. 2015-06-08 20:34:50 +01:00
Johann Klammer 3fb65eb51a single bit reset 2015-06-08 20:34:43 +01:00
Martin Whitaker 3080f5730d Better implementation of assignment lval concatenation synthesis. 2015-06-08 20:27:38 +01:00
Larry Doolittle 2739f83702 Spelling fixes in C and C++ comments 2015-06-04 15:00:29 -07:00
Martin Whitaker 1b3e321d35 Eliminate a few new compiler warnings. 2015-05-04 22:32:29 +01:00
Cary R 02ee3874e7 Space/code cleanup and warn that vvp does not support S/R D-FF 2015-04-20 15:41:44 -07:00
Johann Klammer 891399185f lhs partsel and sync scramble 2015-04-20 15:11:40 -07:00
Cary R 228a3f123a For some local nets fix the local flag and file/line information 2015-01-14 16:40:30 -08:00
Cary R 074f7a7a49 Fix undefined access in for loop synthesis 2015-01-14 15:11:36 -08:00
Martin Whitaker 60ab1daa1f Restore some master branch fixes lost in the vec4-stack merge. 2014-12-07 12:10:15 +00:00
Stephen Williams 2aeb3871ed Merge branch 'master' into vec4-stack
This was a challenging merge...
Conflicts:
	elab_scope.cc
	synth2.cc
	tgt-vvp/eval_expr.c
	vvp/vthread.cc
2014-11-13 16:26:15 -08:00
Stephen Williams ea21fb856e Mux with default, handle possible large selector. 2014-11-09 16:49:21 -08:00
Martin Whitaker 754899c99e Make asynchronous case statement synthesis more robust.
Added various error/warning messages for behaviour not supported
in synthesis. Also give correct behaviour when multiple case item
expressions evaluate to the same constant value.
2014-11-09 20:20:03 +00:00
Cary R f4c88b4a01 Add message that L-value concatenation is not supported in synthesis 2014-08-07 16:26:08 -07:00
Stephen Williams 714795709c Handle casez without default case.
casez statements without default cases can get their input from
the context. This handles that situation properly.
2014-07-19 17:22:33 -07:00
Stephen Williams 7b10570e11 Synthesis handle blocks of FF with unique CE
Like this:
  ... if (ce0) foo <= foo_in;
  ... if (ce1) bar <= bar_in;
Note that this is within a block, and represents multiple FF nodes
with different clock enables.
2014-07-19 15:17:53 -07:00
Stephen Williams d5fb0f4344 Handle some tricky conditions assignments to parts.
When for example assigning to foo[<x>] within a contitional, and
doing synthesis, we need to create a NetSubstitute device to manage
the l-value bit selects.
2014-07-14 16:46:58 -07:00
Cary R 6101044bff Fix gcc compile warning 2014-06-17 10:47:25 -07:00
Stephen Williams c6e44f2da1 Fix argument ordering for synthesized casez compare. 2014-06-16 09:45:03 -07:00
Stephen Williams 3c0a982ab3 More flexible synthesis of DFF with asynchronous set/reset. 2014-06-15 19:10:09 -07:00
Stephen Williams 0f85bf0b9a Basic DFF asynchronous set/reset synthesis support. 2014-06-15 18:22:02 -07:00
Stephen Williams ccce9d9271 Merge branch 'master' into x-sizer5 2014-06-14 19:13:42 -07:00
Stephen Williams 6d2fa6e579 case/x/z synthesis with constant case expression.
If the case expression is constant, then the guards probably are
not, and the synthesis should be handled differently.
2014-06-13 18:22:24 -07:00
Stephen Williams f8dc430fe5 Add synthesis support for casez statements.
This generates an EQZ LPM device that carries the case-z-ness to
the code generator.

Also add to the vvp code generator support for the EQZ device so
that the synthesis results can be simulated.

Account for the wildcard devices in the sizer.
2014-06-13 18:01:41 -07:00
Stephen Williams 26f71f2d94 Handle special case of missing condit inputs.
It shouldn't be possible, but sometimes is, that a NetCondit is
missing input nets during async synthesis. Handle this by generating
a place-holder net and printing a warning.
2014-06-12 17:50:44 -07:00
Cary R 12379ed26a Fix spacing issue. 2014-06-07 18:22:42 -07:00