Commit Graph

6240 Commits

Author SHA1 Message Date
Nick Gasson 9faaf5f817 Add VHDL report statement
Not output yet, but will be used to replace std.textio
implementation of $display.

Conflicts:

	tgt-vhdl/vhdl_syntax.cc
2010-10-05 20:00:16 +01:00
Nick Gasson 2187f30207 Reduce number of 0 ns waits in generated VHDL
Previous we generated a "wait for 0 ns" statement after
every blocking assignment that wasn't the last statement
in the process. While this implements the Verilog semantics,
it generates excessive waits, and cannot usually be synthesised.
This patch only generates "wait for 0 ns" statements when it
cannot be avoid (e.g. when the target of a blocking assignment
is read in the same process).

An example:

  begin
    x = 5;
    if (x == 2)
      y = 7;
  end

Becomes:

  x <= 5;
  wait for 0 ns;    -- Required to implement assignment semantics
  if x = 2 then
    y <= 7;         -- No need for wait here, not read
    -- wait for 0 ns  (previously)
  end if;

Conflicts:

	tgt-vhdl/process.cc
	tgt-vhdl/stmt.cc
	tgt-vhdl/vhdl_target.h
2010-10-05 19:59:25 +01:00
Stephen Williams ec49f10e2d Revert bad merge from vhdl branch 2010-10-02 11:02:27 -07:00
Cary R 7f2cb6afcd Warn the user that synthesis is no longer maintained.
Add code to print a warning if the user tries to use the -S flag.
We need this warning since synthesis is not currently being actively
maintained or supported in any branch after V0.8.
2010-10-02 10:49:37 -07:00
Cary R 3cd928dbe0 Add another missing probe_expr_width() call.
The indexed select width argument was missing a call to
probe_expr_width() and was crashing the compiler.
2010-10-02 10:49:17 -07:00
Stephen Williams 5f64a5ace4 NetCondit may have nil statements when calculating delay types.
It is possible for true clause, false clause, or both, to have
nil statements so the delay_type() method has to account for this.
2010-10-02 10:38:59 -07:00
Stephen Williams c4c7a619ea Merge branch 'vhdl' 2010-10-01 15:13:29 -07:00
Nick Gasson 43f904f793 Add uwire support to VHDL backend
Implemented as std_ulogic which behaves almost identically.
2010-09-30 12:22:39 +01:00
Nick Gasson 419ea8c9ea Merge branch 'generics' into vhdl 2010-09-30 12:16:39 +01:00
Nick Gasson 029fa3fcdf Merge branch 'master' into vhdl 2010-09-30 12:03:56 +01:00
Cary R ea01130ed8 Resize an unsized signed constant if it is less than integer_width.
An unsized signed constant that is smaller than integer_width needs
to be resized up to either the integer_width or the expression width
whichever is smaller.
2010-09-29 17:17:30 -07:00
Larry Doolittle 6388430661 Down payment on const-correctness
Clears out the unambiguous and easy-to-fix const faults,
so we can focus better on the fundamental ones.
2010-09-29 17:15:40 -07:00
Nick Gasson 72f1e5a692 Add find_vars method to VHDL syntax objects
Finds set of read and written variables. For use in
post-processing the syntax tree for cleanup.
2010-09-29 16:57:03 -07:00
Nick Gasson d1314d53bd Reduce superflous parens in generated VHDL
Purely cosmetic, replaces output like:

  if (x + foo(x + (2 * y))) then ...

With:

  if x + foo(x + (2 * y)) then ...
2010-09-29 16:53:45 -07:00
Cary R c71a5f08b9 Fix MinGW specific shadow warning.
This patch removes a MinGW specifc shadow warning.
2010-09-24 15:36:52 -07:00
Cary R 4b16785f16 Fix possible undefined value compiler warning 2010-09-22 13:41:24 -07:00
Larry Doolittle b909c74a20 Spelling fixes
All fixes are in comments, except for one error message (was "iternal error")
2010-09-22 10:43:32 -07:00
Cary R 0dad9e3adb Update fstapi.c to the latest from GTKWave-3.3.12 2010-09-22 09:13:00 -07:00
Cary R cac725ed3d Fix signed/unsigned compare warnings.
Fix all the Icarus files that can be so that we do not have any
signed/unsigned compare warnings. It also removes const as a
return qualifier for two routines in discipline.h.
2010-09-22 09:09:26 -07:00
Cary R f522ca8a9c Pad and sign convert array index expressions as needed.
This patch mimics what was done for vectors, but is simpler since
arrays don't use the endian information. It also needs to address
the fact that .array/port assumes the expression is unsigned so
any signed expression must be padded to make it larger than the
maximum array word when it is converted to unsigned.
2010-09-19 13:41:32 -07:00
Cary R fabde6d1b5 Normalize variable bit/indexed part selects using a fixed routine.
This patch modifies all the variable bit and indexed part selects
to use a common routine. This routine determines the minimum
width needed to calculate the result correctly, pads the expression
if needed and then converts the expression to signed if required to
make the calculation correct.
2010-09-19 13:41:22 -07:00
Cary R dd4fb9b4ef Fix spacing issues.
This patch removes space before a tab and space or tab before end
of line.
2010-09-19 13:21:59 -07:00
Cary R 5ae3e48cdb Fix generation of PS files and hence PDF files on cygwin.
The Cygwin man command requires that you have a / in the path
if you want to avoid looking at the normal search path. This
patch addes ./ before the manual page file name. Which should
work on any system. It also makes the vvp generation create a
PS file like is done in the other Makefiles.

By default we generate normal manual pages. You can then
create PostScript version and from these you can generate a
PDF version.
2010-09-19 13:19:29 -07:00
Cary R acb55916da Resize constants in eval_expr when needed.
If we are given an unsized constant that is smaller then the requested
width then resize the constant to fit.
2010-09-13 16:16:08 -07:00
Cary R 4001c7a27f An if statement is optional and results in no delay.
While checking for an infinite loop in an always block I missed
the case where an if statement does not have a statement. This
was resulting in a segmentation fault.
2010-09-13 14:02:25 -07:00
Nick Gasson d9bf96d8fa Basic parameter support in VHDL target
This is a fix for pr2555831. A separate entity/architecture pair is
generated for each module that is instantiated with a unique
parameter combination.
2010-09-11 12:17:06 +01:00
Cary R b252dc0192 Don't elide unconnected module ports.
When performing a translation we do not want to elide any module
ports. Dropping ports can result in port mismatch issues.
2010-09-08 16:56:47 -07:00
Cary R 4b98a50dce Report and fail gracefully for recursive parameter definitions.
If someone accidentally makes a parameter depend on itself
we need to report this not crash. This patch fixes the crash
and prints an appropriate string of messages to figure out
the loop. Icarus currently supports forward references of
parameters so more complicated loops can be created. These
are also caught.
2010-09-08 16:51:41 -07:00
Cary R 5e1546faaf Don't elide a BUFZ that represents a continuous assignment.
To prevent a force from back propagating we need to keep a BUFZ
that represents a continuous assignment between two nets. This
only effects continuous assignments of the form assign out = in.
In general these are fairly rare so keeping them has minimal
impact on the simulation speed.
2010-09-08 15:16:37 -07:00
Nick Gasson 56525d0c20 Merge branch 'generics' into vhdl 2010-09-08 19:37:00 +01:00
Nick Gasson c87186a15c Add uwire support to VHDL backend
Implemented as std_ulogic which behaves almost identically.
2010-09-08 11:20:54 -07:00
Cary R c9f28902eb Warn the user that synthesis is no longer maintained.
Add code to print a warning if the user tries to use the -S flag.
We need this warning since synthesis is not currently being actively
maintained or supported in any branch after V0.8.
2010-09-04 16:37:38 -07:00
Cary R 6257d31582 Add another missing probe_expr_width() call.
The indexed select width argument was missing a call to
probe_expr_width() and was crashing the compiler.
2010-09-03 18:38:58 -07:00
Nick Gasson e41f2f36a3 List parameters/values in VHDL entity comment
For example:

  -- Generated from Verilog module child (vhdl_tests/generics.v:30)
  --   MY_VALUE = 3
  entity child is

To make it clear which values were used for this entity.
2010-08-28 17:13:23 +01:00
Nick Gasson 0c883a00bf Change VHDL $finish to use report not assert
Changes:

   assert false report "SIMULATION FINISHED" severity failure;

To just:

   report "SIMULATION FINISHED" severity failure;
2010-08-24 22:17:11 +01:00
Nick Gasson 48ae8c1ce5 Generate VHDL report statements for $display
This changes the implementation of $display/$write to use VHDL
report statements rather the the std.textio functions. The code
produced is simpler and more like what a real VHDL designed would
write. However it no longer exactly matches the Verilog output as
most VHDL simulators prepend the text with simulation time, entity
name, severity level, etc. There is a corresponding change in
ivtest to support this.
2010-08-24 22:13:08 +01:00
Nick Gasson 0cec4495ca Add VHDL report statement
Not output yet, but will be used to replace std.textio
implementation of $display.
2010-08-18 23:50:13 +01:00
Nick Gasson f9da800cf5 Reduce number of 0 ns waits in generated VHDL
Previous we generated a "wait for 0 ns" statement after
every blocking assignment that wasn't the last statement
in the process. While this implements the Verilog semantics,
it generates excessive waits, and cannot usually be synthesised.
This patch only generates "wait for 0 ns" statements when it
cannot be avoid (e.g. when the target of a blocking assignment
is read in the same process).

An example:

  begin
    x = 5;
    if (x == 2)
      y = 7;
  end

Becomes:

  x <= 5;
  wait for 0 ns;    -- Required to implement assignment semantics
  if x = 2 then
    y <= 7;         -- No need for wait here, not read
    -- wait for 0 ns  (previously)
  end if;
2010-08-17 22:49:27 +01:00
Nick Gasson 406d3936af Add find_vars method to VHDL syntax objects
Finds set of read and written variables. For use in
post-processing the syntax tree for cleanup.
2010-08-17 22:49:27 +01:00
Nick Gasson 0d6b42885b Reduce superflous parens in generated VHDL
Purely cosmetic, replaces output like:

  if (x + foo(x + (2 * y))) then ...

With:

  if x + foo(x + (2 * y)) then ...
2010-08-17 22:49:27 +01:00
Stephen Williams 2c11850f3c Merge branch 'master' of ssh://steve-icarus@icarus.com/home/u/icarus/steve/git/verilog 2010-08-15 16:38:11 -07:00
Cary R f29d09dcbe Add uwire support/functionality to the stub and vvp back ends
This patch adds a check in the vvp back end that a uwire has
at most one driver. Previously this was just converted (with
a warning message) to a wire just after elaboration.
2010-08-15 16:29:20 -07:00
Cary R 6023ab0893 Remove some incorrect const properties
A recent patch incorrectly change these two methods to const.
2010-08-13 20:16:57 -07:00
Cary R 03f6283203 Add support for calling system functions as a task (SystemVerilog)
This patch adds the ability to call a system function as a task for
the SystemVerilog generation (-g2009). The return value is really
calculated, but it is ignored.
2010-08-13 20:05:23 -07:00
Cary R 860f8627ba Fix some possible memory leaks and make some methods const.
This patch fixes a couple places where there were some memory
leaks on error and also makes some methods const that can be.
Found with cppcheck.
2010-08-11 17:39:20 -07:00
Nick Gasson d33082bca5 Resize VHDL vector before cast in signed comparison
E.g. $signed(x) > y with x, y different sizes should be

  resize(signed(x), N) > y

Not

  signed(resize(x, N)) > y

As this does not treat the sign bit correctly. Was causing
the signed5 test to fail.
2010-08-11 17:34:16 -07:00
Nick Gasson ae0fe9541d Rename modules which are VHDL reserved words 2010-08-11 17:30:27 -07:00
Nick Gasson 5e0f80afca Avoid emitting VHDL Bool_To_Logic calls for common cases
No functional change, just improves the output a bit. E.g.

  x <= Bool_To_Logic(y = z);

Becomes:

  x <= '1' when y = z else '0';
2010-08-08 14:34:13 -07:00
Nick Gasson 090f7730e6 Avoid VHDL type error in concurrent assignment
When translating a relational LPM to concurrent VHDL assignment, the
generated code would be incorrect if the input types differed in
signedness.
2010-08-08 14:34:06 -07:00
Nick Gasson 2d97486897 Rename VHDL instances which are reserved words
Fixes compiler errors with some real-world examples
2010-08-08 14:34:00 -07:00