Commit Graph

10116 Commits

Author SHA1 Message Date
Lars-Peter Clausen d040804036 parser: Fix line location for implicit named port connections
The implicitly generated identifier for implicit named port connections
gets its file and line information from the optional attributes. If no
attribute list is specified this will just point to the beginning of the
file resulting in incorrect line information.

Use the file and line information from the identifier token instead to fix
this.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-06-13 19:28:53 -07:00
Cary R 75cd1a19f0
Merge pull request #938 from larsclausen/unit-scope-possible-imports
Handle implicit task/function imports in the unit scope
2023-06-11 10:07:29 -07:00
Cary R 3780cb2da2
Merge pull request #937 from larsclausen/continue-break-const-func
Support continue/break in constant functions
2023-06-11 09:38:31 -07:00
Lars-Peter Clausen 542d80b1b1 Add regression tests for implicit function/task import the unit scope
Check that implicit import of functions and tasks is supported if the
wildcard import statement is in the unit scope.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-06-11 09:21:00 -07:00
Lars-Peter Clausen c1c4c28313 Handle implicit task/function imports in the unit scope
SystemVerilog requires that functions and tasks are not implicitly imported
if a symbol with the same name appears in the scope, even if it the symbol
is declared after its usage.

To support this a list of potential imports is collected while parsing a
scope and only when the end of the scope is reached it is evaluated whether
the symbol should be imported or not based on whether it already exists in
the scope.

This currently works fine for all scopes except for the unit scope. Since
the unit scope might span multiple files it is never explicitly closed and
the potential imports are never checked.

Make sure that after parsing all files is done the potential imports for
the unit scope are checked.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-06-11 09:20:51 -07:00
Lars-Peter Clausen 946ded13c7 Add regression tests for continue/break in constant functions
Check that continue and break are supported in constant functions.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-06-11 08:56:06 -07:00
Lars-Peter Clausen ea3884fa1e Support continue/break in constant functions
Add support for `continue` and `break` in constant functions. This is done
in a similar way to how `disable` is implemented for constant functions.

Two new global flags are introduced `loop_break` and `loop_continue` that
get set when evaluating the corresponding statement. If either of these
flags are set all other statements are ignored until the end of a loop is
reached. At the end of the loop both `loop_break` and `loop_continue` get
cleared. If `loop_break` was set before clearing it the loop is exited.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-06-11 08:50:30 -07:00
Lars-Peter Clausen 37f7308f80 Add regression test for omitting trailing ports in ordered list connection
Check that it is possible to omit trailing ports in a module ordered list
connection list.

Also check that an error is generated if too many ports are specified in a
ordered list connection.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-06-11 08:45:34 -07:00
Lars-Peter Clausen b8eb21b3ac Allow to omit trailing module ports in ordered list connection
The current implementation expects that for a module instantiation with a
ordered list connection all ports are supplied.

But there doesn't seem to be such a requirement in the LRMs. The Verilog
LRM doesn't mention anything in this regard and the SystemVerilog LRM
mentions in section 23.3.2.1 that a blank or omitted port connection is
either left unconnected or uses the default value of the port.

Update the implementation so that it allows to omit trailing ports and only
generates an error message if too many ports are specified in the ordered
port list.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-06-11 08:45:34 -07:00
Cary R edaa6e6c76
Merge pull request #935 from larsclausen/do-while-continue-break
Handle continue/break in do-while loops
2023-06-11 07:59:01 -07:00
Lars-Peter Clausen 438e510764 Update regression tests for continue/break to cover do-while loops
Also check do-while loops in the regression tests for continue and break
statements.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-06-11 07:20:15 -07:00
Lars-Peter Clausen fb403c6266 tgt-vvp: Handle continue/break in do-while loops
Currently continue and break are supported in most loops. But not in
do-while loops. Add support for them in do-while loops as well.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-06-11 07:20:15 -07:00
Cary R 750ec01352 Update vlog95 immediate assert/assume gold files 2023-06-10 21:19:32 -07:00
Cary R 63bcb9601d
Merge pull request #906 from svenka3/svenka3/labelled_imm_sva
Added support for labels in immediate assert/assume
2023-06-10 20:59:41 -07:00
Cary R ee14cb0eb0 Update displayed Copyright dates 2023-06-10 20:33:08 -07:00
Cary R ed691d25f7 Add wget commands to update config.guess and config.sub 2023-06-10 20:32:50 -07:00
Cary R 6307057e8d Fix space issues 2023-06-10 19:44:10 -07:00
Cary R bff91566ab
Merge pull request #930 from larsclausen/fix-fn-partial-oob-write
Fix incorrect assert for partial oob write to function return value
2023-06-10 18:00:06 -07:00
Cary R bfba4bf6ca
Merge pull request #932 from mole99/overhaul-documentation
[WIP] Documentation Overhaul
2023-06-10 17:54:33 -07:00
Cary R 5bf44cc78d
Merge pull request #904 from a1ca7raz/master
Update config.guess and config.sub to add support for riscv64 platform
2023-06-10 17:54:11 -07:00
mole99 f4345e2d03 Add favicon 2023-06-09 14:07:28 +02:00
mole99 b0c1eab51e Move textfiles to documentation 2023-06-09 13:30:44 +02:00
mole99 41496040e8 Rename to .txt 2023-06-09 13:29:25 +02:00
mole99 265f585096 Document all targets 2023-06-09 13:28:14 +02:00
Cary R c74048a526
Merge pull request #908 from mole99/sdf-info
Move `SDF INFO`,  `SDF WARNING`, `SDF ERROR` to start of line
2023-06-04 21:13:22 -07:00
Cary R a37181ae95
Merge pull request #924 from aelmahmoudy/fix-typos
Fix typos
2023-06-04 21:12:07 -07:00
Cary R 13166092da
Merge pull request #919 from larsclausen/fix-real-format-arm
Fix formatting real to binary and hex strings on ARM
2023-06-04 21:10:49 -07:00
Cary R 9cb3d53633
Merge pull request #918 from larsclausen/fix-single-element-array-ports
Fix connecting single element array ports
2023-06-04 21:09:04 -07:00
Cary R cd293e17af
Merge pull request #895 from larsclausen/fork-in-final
vvp: Handle `%fork` in `final` procedures
2023-06-04 21:07:48 -07:00
Cary R f22c1a519b
Merge pull request #900 from larsclausen/task-return
Support return in tasks
2023-06-04 21:07:30 -07:00
Lars-Peter Clausen 4ab59dd55e Add regression tests for oob write to function return value
Check that partial and fully out-of-bound writes to a function's return
value are handled correctly. Check this for both 4-state and 2-state
vectors.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-06-04 16:27:24 -07:00
Lars-Peter Clausen 925f5fb608 Fix incorrect assert for partial oob write to function return value
Partial out-of-bounds write to a function's return value will trigger an
assert, even though the operation is valid.

The assert checks that the truncated value has the expected width, but
instead it should check that the non-truncated value has the expected with.

Move the assert before the truncation to fix this.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-06-04 16:04:16 -07:00
Cary R 2e84766e79
Merge pull request #893 from larsclausen/array-assign-order
Connect continuous array assignments in the right order
2023-06-02 13:57:18 -07:00
Cary R d3a0e9606f
Merge pull request #891 from larsclausen/init-netnet-port-index
Initialize NetNet::port_index_
2023-06-02 13:54:20 -07:00
Cary R 210ada0a5a Update Python test script to run using 3.5 or newer 2023-06-01 01:06:05 -07:00
Cary R 01c5e502bd Update tests so they can be converted to vlog95 2023-05-31 22:45:06 -07:00
Cary R ef931e2e0d Spelling and space cleanup 2023-05-31 22:44:13 -07:00
Cary R 5439fcd5c2 Update to latest fstapi.c 2023-05-31 20:02:54 -07:00
Cary R 7ac6182d4c Update to compile with older GCC versions 2023-05-31 20:02:36 -07:00
أحمد المحمودي (Ahmed El-Mahmoudy) 08aee81924 Fix typos 2023-05-17 07:08:00 +02:00
Martin Whitaker deeac2edfe Fix broken example code (discussion #922)
'output' is a keyword, so can't be used as a signal name.
2023-05-15 19:42:47 +01:00
Lars-Peter Clausen abe1099335 Fix formatting real to binary and hex strings on ARM
Directly casting a negative double to a unsigned integer type is undefined
behavior and has different results on x86 and ARM based platforms.

On x86 the behavior is similar to casting a signed int to an unsigned
integer, i.e. the sign bit will end up in the MSB. But on ARM the result
will be 0.

To get consistent behavior, first cast to signed integer and then cast the
signed integer value to an unsigned integer value.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-05-08 09:16:00 -07:00
Lars-Peter Clausen 99a9be25f0 Add regression test for single element module port array
Check that connections to a module port array with a single element are
supported.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-05-06 09:58:41 -07:00
Lars-Peter Clausen 829af9f438 Fix connecting single element array ports
The current check to decide whether a port is an array or a scalar signal
uses the number of pins on the NetNet. If it is larger than one the code
assumes that it is an array.

But for arrays with on a single element the number of pins will be 1 and
the port is incorrectly treated as a scalar signal which results in an
error.

Instead of using the number of pins check for the number of unpacked
dimensions to decide whether the port is an array.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-05-06 09:28:40 -07:00
mole99 691159a8fe Move SDF ERROR, SDF WARNING to start of line 2023-04-19 19:30:23 +02:00
mole99 a3bf61030d Move SDF_INFO to start of line 2023-04-19 18:35:32 +02:00
Srinivasan Venkataramanan 2eeedb193d Added support for labels in immediate assert/assume 2023-04-18 22:30:04 +01:00
a1ca7raz 20753ee6c5 Update config.guess and config.sub 2023-04-18 19:26:42 +08:00
Lars-Peter Clausen d1aecf452c Add regression test for return in tasks
Check support for using the return statement in a task.
 * That it is possible to exit form a task using the `return` statement
   without affecting other concurrently running instances of the same task
 * That it is possible to use return in a named block in a task
 * That using a return value in a task results in a elaboration error
 * Returning from inside a parallel block in a task results in a
   elaboration error

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-04-16 19:22:49 -07:00
Lars-Peter Clausen 730c9c28b2 Support return in tasks
SystemVerilog allows to use the `return` statement in a task to exit the
task before it reaches the end of its execution. This is defined in section
13.3 ("Tasks") of the LRM (1800-2017).

This is similar to using `disable` to stop a task from within itself with
the difference that `disable` will affect all concurrently running
executions of a task, while `return` will only affect the task from which
it has been called.

The `%disable/flow` vvp instruction allows to implement the required
behavior for task return.

There is one complication in that it is not allowed to call return from
inside a parallel block (fork-join). If a parallel block is unnamed and has
no variable declarations there won't be a NetScope for it. So it is not
possible to detect whether the return is inside a parallel block by
walking up the scope chain.

To solve this add a design global counter that gets incremented when
entering a fork block and decremented when exiting a parallel block. The
return implementation then checks if the counter is non 0 to determine
whether it is in a parallel block.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2023-04-16 19:22:29 -07:00