Commit Graph

320 Commits

Author SHA1 Message Date
Martin Whitaker d6abe59983 Improve annotation in vvp code generation. 2024-09-03 21:34:46 +01:00
Martin Whitaker f8947a6aab Fix indentation and white space. 2024-09-03 21:34:12 +01:00
Martin Whitaker d99add9dbe Fix vvp code generator for array word alias corner case (issue #1155)
When multiple words in one array were connected to the same nexus as a
single word array, the code generator was sometimes failing to generate
all the necessary aliases. This was highly dependent on the elaboration
order.

This fix should be more robust, but there are currently no tests in the
test suite that cause the compiler to generate whole-array aliases, and
I can't think of a way to make it do so as we don't yet support unpacked
arrays in module ports, so that branch of the code is currently untested.
2024-09-03 21:24:25 +01:00
Paul Rigge 28187823ed
Update handling of single-element arrays.
Also, add a test. This fixes #1113.
2024-04-15 13:14:53 -07:00
Cary R f229dfcb2b Fix the trigger for user functions with no args 2023-09-03 18:41:38 -07:00
Cary R 64cfd681af
Merge pull request #980 from sifferman/argumentless-functions-fix
Argumentless functions fix
2023-09-03 17:31:10 -07:00
mole99 11c944f5e9 Cleanup 2023-08-29 09:54:39 +02:00
mole99 6d3e2bf344 Improve SDF interconnect support, add -ginterconnect flag 2023-08-23 12:56:11 +02:00
Ethan Sifferman eb104a727e initial commit 2023-07-28 22:22:15 -07:00
Cary R dc8b7d0184 Cleanup some cppcheck warnings 2022-12-28 00:00:31 -08:00
Lars-Peter Clausen 5ef847ea87 Support type parameters
SystemVerilog supports type parameters. These are similar to value
parameters, but they allow to pass a type to a module or similar when
instantiating it.

E.g.

```
module A #(parameter type T = int);
endmodule

module B;
  A #(.T(real)) i_a;
endmodule
```

Add support for handling type parameters.

For the vlog95 and vhdl backends type parameters, similar to typedefs, get
replaced with their actual value. For modules with non-local type
parameters for each module instance a unique module or architecture is
generated with the actual type.

Querying type parameters through VPI is not yet supported.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-12-11 13:50:14 -08:00
Lars-Peter Clausen d4765e3354 Don't implement `packed_width()` for dynamic array types
The `netdarray_t` type implements the `packed_width()` method by returning
the packed width of the element type. It is the only non-packed type that
implements the method.

This triggers an assert in the vlog95 backend for tasks with dynamic array
typed parameters. And while the vlog95 backend does not support dynamic
array types it should not result in a crash, just an error message.

The only place that relies on the behavior that the packed width of the
element type is returned is in the vvp backend where variable declarations
are generated. Update that code to query the packed width of the element
type instead and then remove the `packed_width()` implementation for the
`netdarray_t` type.

This fixes the assert in the vlog95 backend. But it is also nicer from an
architectural perspective as this brings the type in line with the other
types in terms of behavior.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
2022-10-08 13:42:45 +02:00
Martin Whitaker e53b2e774b Further fixes for vvp code generation for c. assign of an array word.
The draw_net_input() function can write additional statements to the output
file, so must not be called in the midst of writing a statement.
2022-03-19 10:22:49 +00:00
Martin Whitaker 831db5a0d7 Fix vvp code generation for c. assign shift of array word (issue #632) 2022-03-14 23:24:20 +00:00
Cary R 32787bb973 Add support for SV edge 2021-01-07 01:22:49 -08:00
Cary R e1870acfac Return the correct value when a queue or darray references an undefined element 2020-07-22 21:47:37 -07:00
Cary R dd80607ceb Add CA version of the <-> operator 2020-07-09 01:45:43 -07:00
Martin Whitaker 085f466377 Fix GitHub issue #337 - incorrect uninitialised function return value. 2020-06-25 00:31:43 +01:00
Martin Whitaker 5cd0ba08b1 Fix alloc size warning when building with recent GCC. 2018-10-06 23:25:13 +01:00
Scott Mansell 7b84b29bbc tgt-vvp: Output semicolon after .port_info statements
Backwards compatablity is perserved due to the parser interperting the
unexpected semicolon as an empty statement.
2017-12-16 23:59:48 +13:00
Cary R 3fc9ad2db0 Add support for the wild compare operators ==? and !=? 2017-11-17 19:32:50 -08:00
Stephen Williams d44c814bab Remove .alias records from vvp generated code.
Net arrays can be handled by nets directly, instead of creating
.alias records.
2016-08-31 14:05:09 -07:00
Michele Castellana 9ad46044b4 Cleanup 2016-06-30 17:47:34 +02:00
Martin Whitaker 20104c92c8 Fix for GitHub issue #96 - support mixed constant/variable delays in vvp.
If all three rise/fall/decay delay values are constant, we can use
the vvp .delay statement variant that takes three literal numbers.
If not, we have to use the variant that takes three net inputs. If
some of the delay values are constant, we need to create constant
drivers for those delay inputs.
2016-04-02 19:55:56 +01:00
Johann Klammer d7736d7eba latch for vvp output 2016-03-11 23:44:06 +00:00
Stephen Williams 9a7f31c728 Functions that return strings pass the return value on the stack. 2016-03-01 15:38:28 -08:00
Cary R 7d21891147 Fix space issues. 2016-02-28 22:09:39 -08:00
Stephen Williams 469d4fefa7 Handle compressed assign to function return value. 2016-02-01 12:38:48 -08:00
Stephen Williams c114edfa6c Handle void functions with new .scope format. 2016-02-01 09:29:49 -08:00
Stephen Williams fac7de2133 Better handle some different function types in the .scope setup. 2016-01-31 16:16:02 -08:00
Stephen Williams 604a62379c Make .scope aware of return type, and extend %ret/vec4 operands
The .scope needs to be aware of return types so that the %call/vec4
function knows how to intialize the return value. We also need to
extend the %ret/vec4 to support writing parts of the return value.
2016-01-31 15:29:52 -08:00
Stephen Williams e435a879fc Add ability to read back return value / Add vec4 stacked user functions.
Also:
- handle functions as arguments to system tasks.
- Cleanup detect of signal as return value.
2016-01-24 18:36:26 -08:00
Stephen Williams 0c91a6b041 Add .ufunc/real functor to handle functions with return value on stack. 2016-01-17 16:23:28 -08:00
Stephen Williams bfc9cd8715 Make real functions in processes use parent stack for return value. 2016-01-10 17:09:33 -08:00
Cary R 6c91588d33 Fix some errors found with cppcheck 2015-11-02 00:14:29 -08: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
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
Cary R b3425d6cf3 Report that 4-state dynamic arrays are not currently supported in vvp
Also fix some error code propagation issues.
2015-01-16 18:22:16 -08:00
Stephen Williams dec4cd5071 Handle arrays of class objects.
This goes all the way down to the vvp level, where we create support
for arrays of objects, generate the new code in the -tvvp code
generator, and elaborate the arrays in the first place.
2014-08-30 10:18:57 -07:00
Stephen Williams e8b8fcba57 Support declaring queue variables all the way to vvp.
Nothing actually useful happens here, but the declarations
are functional.
2014-08-21 16:44:45 -07:00
Cary R 0a6d75f1db Fix some cppcheck warnings (format string vs argument mismatches) 2014-08-01 18:55:44 -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
Larry Doolittle ae6743cf69 Easy changes for -Wmissing-prototypes 2014-07-10 14:07:30 -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 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
Martin Whitaker 529e029abd Fix for GitHub issue #28 - Insufficient string escaping in vvp script.
" characters in strings must be escaped when the compiler writes a
quoted string to a vvp script. This patch fixes up a few places where
this wasn't being done.
2014-06-09 22:40:26 +01:00
Larry Doolittle 855bf9cfe8 Pick some low-hanging const fruit
Makes more of the code const-correct; there are still plenty of difficult-to-fix const problems left.
No behavior change expected.
2014-06-09 10:47:28 -07:00
Stephen Williams 3b3a4d3ddc vvp code generation for class methods in class scope. 2013-03-24 15:12:35 -07:00
Stephen Williams fb23493a98 Class methods down to the code generator
Emit the elaborated class methods. Also generate root scopes to
represent the classes in order to hold the methods. These scopes
can also in the future be used to implement static properties.
2013-03-24 15:12:35 -07:00