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

AxiWrite and AxiRead procedures with expected response code #15

Open
Paebbels opened this issue Jul 3, 2022 · 2 comments
Open

AxiWrite and AxiRead procedures with expected response code #15

Paebbels opened this issue Jul 3, 2022 · 2 comments

Comments

@Paebbels
Copy link
Member

Paebbels commented Jul 3, 2022

The following procedures will add the capability to expected a non-good response code.

Usecases:

  1. Check for read-only registers
    log("Check 'status' register");
    ReadCheck(AXILite_ConfigManager, 32x"04", x"0012");
    AxiWrite( AXILite_ConfigManager, 32x"04", x"00FF", AXI4_RESP_DECERR); -- AXI4_RESP_SLVERR);
    ReadCheck(AXILite_ConfigManager, 32x"04", x"0012");
  2. Check for registers out off address range (assuming AXI4-Lite register has only 3 registers (0x00, 0x04, 0x08):
    log("Check invalid register address");
    AxiRead( AXILite_ConfigManager,  32x"0C", Data,    AXI4_RESP_DECERR);
    AxiWrite(AXILite_ConfigManager,  32x"0C", x"00FF", AXI4_RESP_DECERR);

Implementation:
File: AxiOptionsPkg.vhd

		-- Blocking Write Transaction with optional expected resonse code.
		procedure AxiWrite (
			signal   TransactionRec       : inout AddressBusRecType ;
			constant iAddr                : in    std_logic_vector ;
			constant iData                : in    std_logic_vector ;
			constant ExpectedResponseCode : in    Axi4RespType := AXI4_RESP_OKAY ;
			constant StatusMsgOn          : in    boolean := false
		) is
			variable currentResponseCode : Axi4RespType;
		begin
			GetAxi4Options(TransactionRec, BRESP, currentResponseCode);
			SetAxi4Options(TransactionRec, BRESP, ExpectedResponseCode);
			Write (TransactionRec, iAddr, iData, StatusMsgOn);
			SetAxi4Options(TransactionRec, BRESP, currentResponseCode);
		end procedure AxiWrite ;
		
		-- Blocking Read Transaction with optional expected resonse code.
		procedure AxiRead (
			signal   TransactionRec       : inout AddressBusRecType ;
			constant iAddr                : in    std_logic_vector ;
			variable oData                : out   std_logic_vector ;
			constant ExpectedResponseCode : in    Axi4RespType := AXI4_RESP_OKAY ;
			constant StatusMsgOn          : in    boolean := false
		) is
			variable currentResponseCode : Axi4RespType;
		begin
			GetAxi4Options(TransactionRec, RRESP, currentResponseCode);
			SetAxi4Options(TransactionRec, RRESP, ExpectedResponseCode);
			Read (TransactionRec, iAddr, oData, StatusMsgOn);
			SetAxi4Options(TransactionRec, RRESP, currentResponseCode);
		end procedure AxiRead ;
@JimLewis
Copy link
Member

JimLewis commented Jul 3, 2022

I would keep AxiOptions just for options.

How about we add this one as AxiTransactionExtensionsPkg. Would you like to do a pull request for it?

@Paebbels
Copy link
Member Author

Paebbels commented Jul 3, 2022

Please move it to an appropriate place. It was heard to find a place to meet all dependencies.

If you like to note me as an author, use this as an additional line in the commit message:

Commit message is here.

Co-authored-by: Patrick Lehmann <[email protected]>

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

No branches or pull requests

2 participants