Skip to content

Add doc about SVIF (system verilog interface)#247

Open
yportne13 wants to merge 3 commits intoSpinalHDL:masterfrom
yportne13:svif
Open

Add doc about SVIF (system verilog interface)#247
yportne13 wants to merge 3 commits intoSpinalHDL:masterfrom
yportne13:svif

Conversation

@yportne13
Copy link
Copy Markdown
Contributor

@yportne13 yportne13 changed the title [WIP] Add doc about SVIF [WIP] Add doc about SVIF (system verilog interface) Mar 21, 2024
@andreasWallner
Copy link
Copy Markdown
Collaborator

FYI: while WIP please open as a draft - then it doesn't show up in the inboxes of the maintainers to review.

@yportne13 yportne13 changed the title [WIP] Add doc about SVIF (system verilog interface) Add doc about SVIF (system verilog interface) Apr 2, 2024
@Dolu1990
Copy link
Copy Markdown
Member

Hi,

One thing which is important i think, is to specify in the doc that this feature may be subject to changes (experimental)
That will let us more wiggle room for future updates :)

Copy link
Copy Markdown
Collaborator

@mrcmry mrcmry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi !

I have seen that the PR to the spinal lib has been merged in dev and is in v1.14.1.

I did some typo suggestions, you can use the github web interface to add them to a batch and merge them in a commit in the web interface (see this doc).

And then if it's ok for you we can merge this PR.

Description
^^^^^^^^^^^

The ``SVIF`` type specifically targets system Verilog designs.This type extends from ``Bundle``.When generating Verilog or VHDL, the behavior of this type is exactly the same as that of ``Bundle``.However, when generating System Verilog and enabling the ``svInterface`` option in SpinalConfig, this type will be generated as an Interface.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The ``SVIF`` type specifically targets system Verilog designs.This type extends from ``Bundle``.When generating Verilog or VHDL, the behavior of this type is exactly the same as that of ``Bundle``.However, when generating System Verilog and enabling the ``svInterface`` option in SpinalConfig, this type will be generated as an Interface.
The ``SVIF`` type specifically targets system Verilog designs. This type extends from ``Bundle``. When generating Verilog or VHDL, the behavior of this type is exactly the same as that of ``Bundle``. However, when generating System Verilog and enabling the ``svInterface`` option in SpinalConfig, this type will be generated as an ``Interface``.


The ``SVIF`` type specifically targets system Verilog designs.This type extends from ``Bundle``.When generating Verilog or VHDL, the behavior of this type is exactly the same as that of ``Bundle``.However, when generating System Verilog and enabling the ``svInterface`` option in SpinalConfig, this type will be generated as an Interface.

This type is still an experimental feature
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This type is still an experimental feature
This type is still an experimental feature.

.. code-block:: scala

case class Color(channelWidth: Int) extends SVIF {
val width = addGeneric("WIDTH", channelWidth)// or addParameter
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
val width = addGeneric("WIDTH", channelWidth)// or addParameter
val width = addGeneric("WIDTH", channelWidth) // or addParameter

case class Color(channelWidth: Int) extends SVIF {
val width = addGeneric("WIDTH", channelWidth)// or addParameter
val r, g, b = UInt(channelWidth bits)
tieGeneric(r, width)// or tieParameter
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tieGeneric(r, width)// or tieParameter
tieGeneric(r, width) // or tieParameter

Definition Name
~~~~~~~~~~~~~~~

you can use ``setDefinitionName`` to set the definition name. But remember to use it before any clone of this interface
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
you can use ``setDefinitionName`` to set the definition name. But remember to use it before any clone of this interface
You can use ``setDefinitionName`` to set the definition name. But remember to use it before any clone of this interface.

Not Interface
~~~~~~~~~~~~~

If you have used a certain interface in multiple places, and at one of those locations ``sigA``, you wish to flatten it instead of generating an interface, you can achieve this by calling ``sigA.notSVIF()`` to fully flatten the signal. If the signal has nested interfaces and you only want to expand the outermost layer, you can use ``sigA.notSVIFthisLevel()``.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confuse by "sigA". I can not find it in the spinalhdl code base so I suppose it's some kind of example signal name. Would it not be clearer to call it "mySignal" ?

.. _SVIF:

SVIF
======
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
======
====

def slv = asSlave
}

this will generate system verilog code as below:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
this will generate system verilog code as below:
This will generate system verilog code as below:

Not Interface
~~~~~~~~~~~~~

If you have used a certain interface in multiple places, and at one of those locations ``sigA``, you wish to flatten it instead of generating an interface, you can achieve this by calling ``sigA.notSVIF()`` to fully flatten the signal. If the signal has nested interfaces and you only want to expand the outermost layer, you can use ``sigA.notSVIFthisLevel()``.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you have used a certain interface in multiple places, and at one of those locations ``sigA``, you wish to flatten it instead of generating an interface, you can achieve this by calling ``sigA.notSVIF()`` to fully flatten the signal. If the signal has nested interfaces and you only want to expand the outermost layer, you can use ``sigA.notSVIFthisLevel()``.
If you have used a certain interface in multiple places, and at one of those locations ``mySignal``, you wish to flatten it instead of generating an interface, you can achieve this by calling ``mySignal.notSVIF()`` to fully flatten the signal. If the signal has nested interfaces and you only want to expand the outermost layer, you can use ``mySignal.notSVIFthisLevel()``.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants