Commit Graph

47 Commits

Author SHA1 Message Date
Dennis Potter 49d1b598f0
Add setup.py to repository to install srdl2sv 2021-10-24 12:14:03 -07:00
Dennis Potter ec02290bbe
Move several methods to common Components ancestor
For example, most methods relating to dimensions or genvars were moved
to the Components class.

Furthermore, some more care was taken of _ or __ prefixes for methods:

    - No method-prefix: Public variable that is will be called by
                        non-related functions and methods.
    - _  method-prefix: Method will be called by class or class that
                        inerhits class
    - __ method-prefix: Method will be called by class itself only
2021-10-24 00:07:59 -07:00
Dennis Potter abf3fac24f
Minor clean up, mostly Python Lint warnings 2021-10-20 23:51:07 -07:00
Dennis Potter 4d3f302a54
Add initial support for memory type registers 2021-10-18 23:40:19 -07:00
Dennis Potter e05408e8a1
Add support for inline-comments
It is possible to enable them for:

- fields
- registers
- regfiles
- addrmaps
2021-10-17 00:53:22 -07:00
Dennis Potter ed08d4bd35
Fix external-register bug where the sw_rd-wire is missing
This was introduced in dc37c879 because sw_rd-wires got removed
here for registers that don't need it.
2021-10-06 23:39:04 -07:00
Dennis Potter ace4238ccf
Fix bug in external read-interface
In dc37c879, some properties got saved in self.properties of a
Component. In that commit, self.properties['sw_rd'] never got set.
For that reason, external registers with a read-interface were broken.
2021-10-06 23:20:55 -07:00
Dennis Potter 694f7c124e
Make stickybit available for non-intr fields and add support for sticky 2021-10-03 15:48:27 -07:00
Dennis Potter f30dce67c2
Give all genvars an gv_ prefix to prevent collisions 2021-10-02 00:38:31 -07:00
Dennis Potter dc37c87944
Ensure that sw_rd/sw_wr wires are only generated if they are required 2021-10-02 00:32:04 -07:00
Dennis Potter 6359883c27
Finish initial version of interrupt suport, closes #1
The software is now able to create most interrupt combinations of
Section 9.9 of the SystemRDL 2.0 LRM. It supports
stickybit/non-stickybit interrupts, it support posedge, negedge,
bothedge, and level interrupts, and it is able to generate all
surrounding logic.

This commit also fixes a reset-bug that caused registers that were reset
to 0 to be not reset (because 'if not reset_value' will return True if
the 'reset_value' is 0).
2021-09-26 19:40:04 -07:00
Dennis Potter c52e59abd0
Add basic interrupt framework
Up to this point, interrupt outputs are generated and intr, enable,
mask, haltenable, and haltmask are supported. stick, stikcybit and the
different types of interrupts are not yet supported.

This commit also removes the option to turn off santiy checking. This is
a bad idea anyway...
2021-09-25 20:49:39 -07:00
Dennis Potter 5475bbf62d
Fix issue that causes 'input None' if no reset is present for a field 2021-09-06 22:42:32 -07:00
Dennis Potter 24d5534037
Add support for external registers
Every single field and every single alias (!) has its own
interface to the surrounding hardware. This is required
to give users the maximum amount of freedom when defining
certain properties in RDL.
2021-09-06 18:48:37 -07:00
Dennis Potter c689190080
Add proper support for rdy & error indication in read multiplexer
The error indication is generated if:
    - A non-existent register gets read
    - An existent register gets read but not a single bit can be
      succesfully read or written. As soon as 1 bit succeeds don't
      return an error.
2021-09-06 00:26:08 -07:00
Dennis Potter 78742daba7
Add support for 'next' property to fields 2021-08-15 14:10:22 -07:00
Dennis Potter a74377bae7
Add underflow property and checker if referenced properties exist 2021-08-15 12:56:41 -07:00
Dennis Potter 1d5bc8b75e
Fix assignment of overflow to increment input of counter 2021-08-15 12:28:07 -07:00
Dennis Potter fd75e4c84c
Update systemrdl-compiler to v1.19.0
The main difference in this release
(https://github.com/SystemRDL/systemrdl-compiler/releases/tag/v1.19.0)
is that FieldNode.get_property('resetsignal') will now default to
finding the nearest in-scope field reset signal if not explicitly set.
The same is true for the cpuif-signal.

Before this commit, the addmap-class searched for resetsignal and cpuif
signals and saved it for the fields to be picked up later. This code is
now not required anymore
2021-08-15 11:46:40 -07:00
Dennis Potter 1d50b2b457
Add incrthreshold/decrthreshold support
It is still not possible to assign overflow/threshold signals to any
input of a different register!
2021-06-29 00:14:51 +02:00
Dennis Potter 18204d9a3e
Improve counter property
The counter now covers more corner cases regarding saturation.
Furthermore, a bug that caused incr & decr-counters to always
inadvertently increment and decrement, even if only one of the two
signals was set.

Furthermore, the overflow signal is now generated in RTL.

Still missing:
    - incrthreshold/decrthreshold is not yet supported
    - It is not yet supported to assign an underflow/overflow to the
      input of another counter.
2021-06-28 23:58:45 +02:00
Dennis Potter a0dd59d19a
Add hwenable and hwmask property 2021-06-28 12:48:17 +02:00
Dennis Potter c00550a166
Add hwset & hwclr properties 2021-06-28 00:37:54 +02:00
Dennis Potter 9385f59ac7
Add counters (w/o threshold property and w/o an overflow property)
Saturating and non-saturating counters are supported. Furthermore,
dynamic and static incrvalues and the incrwidth property is supported.
2021-06-27 17:04:48 +02:00
Dennis Potter 5ed7cccd7f
Cleanup __add_swmod_swacc and extend verbosity of warnings/debug 2021-06-27 00:21:41 +02:00
Dennis Potter 2e22d82146
Add swmod and swacc properties and fix field-range bug 2021-06-27 00:09:28 +02:00
Dennis Potter 32c6fc3c4a
Add read-multiplexer logic
Evaluating every single wire is maybe not the best way to do this, but
it is probably better than writing a very exotic SV construct with
(for-)loops, breaks, and a lot of conditions. Most synthesis tools are
pretty good at recognizing this case-construct and generating a good
mutliplexer.
2021-06-23 01:03:11 +02:00
Dennis Potter b2c756af41
Add support for alias registers
This required some fundamental changes. One of them is that YAML fields
are now processed in a more systematic way in which all fields are
passed via a dictionary. That way, some of the fields are not bound to
the original object anymore.
2021-06-12 01:28:29 +02:00
Dennis Potter 9deb28ce4e
Add initial version of widget-code and fix remaining SV compiler errors
This adds initial support for a dynamic bus-protocol to internal
register logic SHIM. The chosen default protocol at this point is AMBA 3
AHB Lite and the logic is still empty.

    -> TODO: Adding the widget instantiation showed that it is required
    to have a better interface to parametrize ports & signals in the
    YAML. At this point, only a limited set of variables are supported.

Furthermore, all remaining Verilator compilation issues in the field are
resolved. Those were mostly related to non-declared wires and wrongly named
wires.
2021-06-05 15:37:09 +02:00
Dennis Potter 21abdefac0
Add genvar declaration to addrmap 2021-06-03 18:07:17 +02:00
Dennis Potter ec492d619a
Fix widths in OnWrite and OnRead properties 2021-06-03 16:11:58 +02:00
Dennis Potter 22f88efcd8
Fix compile error because of multiple else branches
This is caused by register access properties that don't have a
condition. As soon as such a property is encountered, no more branches
shall be added to that register.
2021-06-03 12:53:39 +02:00
Dennis Potter 4f6010eed2
Dump addrmap packages with enums
This commit only adds package supports for addrmaps. It should be
relatively easy to extend this for regfiles in a future commit.

Furthermore, this commit adds support to _disable_ enums.
2021-06-03 12:02:27 +02:00
Dennis Potter 8a82d37737
Add regfile capabilities
Apart from adding regfiles in general (which is mostly a combination of
addrmap and register code), the stride/array_dimension code had to be
revisted to be correct for multi dimensional arrays with multi
dimensional registers.

Lastly, the logger instantiation has been moved to the __init__()
method of `Component`.
2021-05-31 00:37:41 +02:00
Dennis Potter 2a3cc9505e
Add support for field_reset and cpuif_reset
These two special kind of resets are now recognized by the compiler and
are propagated to all regfiles, registers, and fields.

Furthermore, every object has a set of resets which will be used to
generate a seperate input section for resets in the addrmap.
2021-05-24 14:42:24 +02:00
Dennis Potter 44c87af8cb
Fix active_low/active_high reset bug
A negation was added for active_high, rather than an active_low reset.
2021-05-24 11:49:51 +02:00
Dennis Potter b7c1a12179
Add support for enumeration encoding
Fields that are encoded as enumerations are now recognized by the
application. All relevant information will be saved in the Field Object
and the variables and I/O list will be generated accordingly.

This commit also adds dynamic padding of the I/O and variable lists.

Still lacking is the automatic generation of SV packages.
2021-05-24 11:41:45 +02:00
Dennis Potter 085e2ea2dc
Provide more advanced way of adding internal signals or ports
Now, every snippet of RTL in the YAML file can also hold internal
variables (i.e., signals), input or output ports. Furthermore, the
input/output port lists are replaced by a dictionary to prevent
duplicate entries.
2021-05-23 17:46:48 +02:00
Dennis Potter 203f1e1b36
Add swwe and swwel properties
Note: swwe=True & swwel=True are not yet supported (since they don't
really make sense). At this point, references are (partly) supported.
2021-05-16 23:53:58 +02:00
Dennis Potter 92d61dd7c8
Add onread/onwrite properties to field class
This commit also created a seperate private method for access related
RTL and for the always_ff header.

Furthermore, a bug which caused the singlepulse property to always show
up was resolved.

Lastly, the summary method was made truely public. So, rather than
writing to the RTL list, it now returns a list and the calling
method/function can decide what to do with that list.
2021-05-16 12:49:17 +02:00
Dennis Potter 4b9ad7ad1b
Fix SW write wire and improve I/O packed dimension 2021-05-15 18:00:02 +02:00
Dennis Potter 4738cbfe6c
Add support for 1 packed and 26 unpacked dimensions in addrmap's I/O 2021-05-15 01:17:06 +02:00
Dennis Potter cecb73f07a
Fundamental changes to the architecture of component classes
All components (e.g., fields, registers, addrmaps) are now children
of a common class Component. This common class has certain common
methods such as get_ports(), get_rtl(), or create_logger().

The AddrMap is now prepared to support alias registers by saving the
registers in a dictionary. That way, registers can easily be accessed
once an alias to a register is found. Furthermore, the addrmap template
is now also loaded from a YAML file. Lastly, the first preparements to
insert ports into the addrmap module are made.

For templates, the indents do not need to be added anymore to the
template. Now, a seperate method will automatically indent the RTL
based on simple rules (e.g., increment indent if `begin` is found).
The CLI also supports settings for the tabs (i.e., real tabs or spaces
and the tab width).

A lot of functionality from the __init__() method of the field class
got reorganized. More logic will be reorganized in the future.
2021-05-15 00:29:59 +02:00
Dennis Potter 59b91536ed Propgate logger through components and let top-level write SV
Previously, the SystemVerilog was simply written to the shell. This
started to become too long to be readable. Now, the application dumps
everything to the output directory that is defined on the command line
(or the default).

Temporary workaround: the AddrMap component's RTL is completely
overwritten by the Register's RTL. This is temporary until the AddrMap
also uses a YAML file.
2021-05-11 00:28:52 +02:00
Dennis Potter c32bfdd8c0
Change way SV keyword 'else' is added to access_rtl
At this point, it is still added in an for-loop. The reason is that
this code might get more extensive and become otherwise unreadable.
2021-05-08 11:52:34 +02:00
Dennis Potter f1d9ba2656
Change way the order of RTL is determined
By using a dictionary, it will be easier to mix & match the RTL
order dependend on the properties of the field.

This commit also adds anded/ored/xored properties.
2021-05-04 00:23:14 +02:00
Dennis Potter 861a020aff
Initial commit of SRDL2SV
The compiler in this commit is still useless and only contains a
very rough skeleton of the code. SRDL2SV is only able to
create a simple register with hw=rw/sw=rw fields.
2021-05-02 00:58:43 +02:00