Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AXI4 #14

Closed
wants to merge 10 commits into from
Closed

AXI4 #14

wants to merge 10 commits into from

Conversation

Paebbels
Copy link
Member

@Paebbels Paebbels commented Jul 5, 2020

This PR is blocked by #13.


This PR adds ARM's AMBA AXI v4 interfaces:

  • AXI4 (full)
  • AXI4-Lite
  • AXI4-Stream

A common package is added, too, to hold common interface descriptions (types) and subtypes.


/cc @JimLewis, @NJDFan

@Paebbels Paebbels added the Internal Mainly internal interface between components. label Jul 5, 2020
@Paebbels Paebbels self-assigned this Jul 5, 2020
@Paebbels
Copy link
Member Author

Paebbels commented Jul 5, 2020

These files have been successfully checked by Riviera-PRO 2020.04.

@Paebbels Paebbels added this to the Prepare first release milestone Jul 5, 2020
@JimLewis JimLewis marked this pull request as ready for review July 5, 2020 17:04
use work.AXI4_Lite.all;


package AXI4_Lite_generic is
Copy link

@JimLewis JimLewis Jul 5, 2020

Choose a reason for hiding this comment

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

Again on naming Axi4Lite_generic or Axi4Lite_GenericPkg
Also, maybe we should do AXI4 Full and then have AXI4 Lite be a subtype of the full with the unused arrays as NULL.
Even with FULL, there are going to be variations - IE awuser width.

subtype AXI_Protect_Type is std_ulogic_vector(2 downto 0);
subtype AXI_Response_Type is std_ulogic_vector(1 downto 0);

type AXI_System_Interface is record
Copy link

Choose a reason for hiding this comment

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

Looks like there are tabs in the file. This causes rendering differences in different tools.
Can we do spaces instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

tabs are intended. Space for indentation will be fixed with next upload.


-- Payload signals
ID :
Address : Address_Type;

Choose a reason for hiding this comment

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

These names should be the same as the AxiBus names.
If you are going to shorten them, by removing the AW, ok
but keep the reset of the name the same, hence,
it should be Addr and not Address and
Prot and not Protect.

Copy link
Member Author

Choose a reason for hiding this comment

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

The AXI interface in itself is a bad example for naming. So we can either improve it to something better, that allows good code review in new code or to keep that legacy for ever and create unreadable files wherever you use AXI.

Choose a reason for hiding this comment

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

I'm also in favor of using more readable/descriptive names unless the abbreviations are very well and generally established. The downside is of course the mismatch with the standard. Same type of value/cost trade-off we need to do with master/slave. b is a good example of a completely unreadable name while I think id is a well established abbreviation.

Choose a reason for hiding this comment

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

Similar to ID, I think the rest of the AXI abbreviated names (Addr, Strb, ...) are well established, and hence, we should not be changing them.

use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;


Choose a reason for hiding this comment

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

Is there a reason to have a subtype for these?

To many levels of indirection leads to obfuscation.

Copy link
Member Author

Choose a reason for hiding this comment

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

On of the problems in OSVVM is that there is not enough abstraction. E.g. barriers use std_logic instead of a Barrier_Type. Now OSVVM is fixed to std_logic or it needs to offer many overloads.

On the other hand, OSVVM has good abstraction with ModellIDs to be AlertLogIDType.

Choose a reason for hiding this comment

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

When it comes to abstractions we need to consider if the type is at risk of changing and what the user implications would be. I agree that a public interface to a barrier can have its own type as that would allow the concept to evolve without breaking backward compatibility (at least to some degree). Here I'm thinking Data_Type is an example of a type not likely to change and even if it did it wouldn't affect a verification component user only using the interface type.

ReadAddress : Axi4_Address_Interface;
ReadData : Axi4_ReadData_Interface;
end record;

Copy link

@JimLewis JimLewis Jul 10, 2020

Choose a reason for hiding this comment

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

The current version of the OSVVM Interface uses WriteAddress, WriteData, ... also, however, I am wondering if we should not be using the AXI names, AW, W, B, AR, R? Simply from the stand point, when people see it in the code, they understand it.

IF we are going to change it in OSVVM, now is the time.

I also think that if you are going to use WriteAddress instead of AW, then you need to use AW in the record field names. And hence, it is AW.Addr. WriteAddress.Addr makes people think about the association too much. WriteAddress.AWAddr is also ok.

We need tighter correlation of the interface record naming and AXI naming for reviews.

I am just struggling with the fact that when it is AxiBus.WriteAddress.AWAddr (or AxiBus.WriteAddress.Addr) that I want an alias - and I would like to avoid wanting to use aliases.

Copy link
Member Author

Choose a reason for hiding this comment

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

Abbreviations is not good coding style. People don't need to think, they just need to read, because we have no abbreviations anymore. More over, if people don't know what AWAddr is, that it demonstrates two things:

  1. the have not understood AXI and it's signal names
  2. that AXI uses bad naming

An other rule for coding style is DRY (don't repeat yourself).


As we have this discussion now, you see why I want aliases for records to rearrange and rename for such situations.

Copy link

@LarsAsplund LarsAsplund left a comment

Choose a reason for hiding this comment

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

I've not really reviewed against the standard. Just general comments.

@@ -0,0 +1,160 @@
-- EMACS settings: -*- tab-width: 2; indent-tabs-mode: t -*-

Choose a reason for hiding this comment

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

I think we should use spaces only. Tabs will cause more problems for people than it helps since most are using spaces (on Github). It would also be impossible for us to create a header that would adapt to all editors/viewers that people are using.

-- vim: tabstop=2:shiftwidth=2:noexpandtab
-- kate: tab-width 2; replace-tabs off; indent-width 2;
-- =============================================================================
-- Authors: Rob Gaddi

Choose a reason for hiding this comment

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

Will all respect for your contributions I think this is for git to keep track of. Maintaining this list is just extra work.


-- Payload signals
ID :
Address : Address_Type;

Choose a reason for hiding this comment

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

I'm also in favor of using more readable/descriptive names unless the abbreviations are very well and generally established. The downside is of course the mismatch with the standard. Same type of value/cost trade-off we need to do with master/slave. b is a good example of a completely unreadable name while I think id is a well established abbreviation.

Valid : std_ulogic;
Ready : std_ulogic;

-- Payload signals

Choose a reason for hiding this comment

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

I think we should consider defining transaction types that holds the payload. They can be used at a higher level of abstraction

use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;


Choose a reason for hiding this comment

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

When it comes to abstractions we need to consider if the type is at risk of changing and what the user implications would be. I agree that a public interface to a barrier can have its own type as that would allow the concept to evolve without breaking backward compatibility (at least to some degree). Here I'm thinking Data_Type is an example of a type not likely to change and even if it did it wouldn't affect a verification component user only using the interface type.

User : User_Type;
end record;

type Axi4_Interface is record

Choose a reason for hiding this comment

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

Shouldn't the system interface be included? I guess that would mean we can't define one view as the converse of the other.

constant AXI4_PROTECT_NONE : Protect_Type := "000";


type AXI4_System_Interface is record

Choose a reason for hiding this comment

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

Indentation

package Axi4 is
type Axi4_Address_Interface is record
-- Handshake signals
Valid : std_ulogic;

Choose a reason for hiding this comment

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

valid and ready are used many places. Create a handshake type maybe?

Choose a reason for hiding this comment

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

At the place where you use them you will need to break the abstraction to initialize the signal you are driving.

);

subtype Axi4Lite_WriteData_SizedInterface is Axi4Lite_WriteData_Interface(
Data(DATA_BITS - 1 downto 0),

Choose a reason for hiding this comment

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

Another style issue. Alignment causes extra manual work as long as we have no open formatter. As a result we will have more whitespace diffs to deal with during code review. There's probably not a widespread consensus on what alignment to use either



package Axi4Stream is
type Axi4Stream_Interface is record

Choose a reason for hiding this comment

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

This interface is not complete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Internal Mainly internal interface between components. Memory-Mapped SoC Bus Architecture Streaming
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants