5.2.7. C++ classes

This section describes:

Class pv::TransactionGenerator

The pv::TransactionGenerator class provides efficient mechanisms for bus masters to generate transactions that are transmitted over the pvbus_m port of the associated PVBusMaster subcomponent.

You can produce pv::TransactionGenerator objects by invoking the createTransactionGenerator() method on the control port of a PVBusMaster component.

TransactionGenerator efficiency considerations

Each Transaction Generator caches connection information internally. This improves efficiency for multiple accesses to a single 4KB page. If a component requires repeated access data from a number of different pages, for example when streaming from one location to another, you are advised to create one transaction generator for each location being accessed.

You can dynamically create and destroy Transaction Generators, but it is better to allocate them once at initialization and destroy them at shutdown. See the DMA example in the examples directory of the System Canvas Model Library distribution.

TransactionGenerator class definition

class pv::TransactionGenerator
	// Tidy up when TransactionGenerator is deleted.

	// Control AXI-specific signal generation for future transactions.
	// Privileged processing mode.
	void setPrivileged(bool priv = true); 
	// Instruction access (vs data).
	void setInstruction(bool instr = true);
	// Normal-world access (vs secure).
	void setNonSecure(bool ns = true); 	
	// Locked atomic access.
	void setLocked(bool locked = true);
	// Exclusive atomic access access.
	void setExclusive(bool excl = true); 

	// Generate transactions
	// Generate a read transaction.
	bool read(bus_addr_t, pv::AccessWidth width, uint32_t *data);
	// Generate a write transaction.
	bool write(bus_addr_t, pv::AccessWidth width, uint32_t const *data); 

	// Generate read transactions. 
	bool read8(bus_addr_t, uint8_t *data);
	bool read16(bus_addr_t, uint16_t *data); 
	bool read32(bus_addr_t, uint32_t *data);
	bool read64(bus_addr_t, uint64_t *data);

	// Generate write transactions.	
	bool write8(bus_addr_t, uint8_t const *data); 
	bool write16(bus_addr_t, uint16_t const *data); 
	bool write32(bus_addr_t, uint32_t const *data); 
	bool write64(bus_addr_t, uint64_t const *data);

Enum pv::AccessWidth

Selects the required bus width for a transaction. Defined values are:

  • pv::ACCESS_8_BITS

  • pv::ACCESS_16_BITS

  • pv::ACCESS_32_BITS

  • pv::ACCESS_64_BITS.

Class pv::Transaction

The pv::Transaction class is a base class for read and write transactions that are visible in the PVBusSlave subcomponent. The class contains functionality common to both types of transaction.

The pv::Transaction class provides an interface that permits bus slaves to access the details of the transaction. Do not instantiate these classes manually. The classes are generated internally by the PVBus infrastructure.

This base class provides access methods to get the transaction address, access width, and bus signals. It also provides a method to signal that the transaction has been aborted.

class pv::Transaction
	// Accessors
	bus_addr_t getAddress() const;          // Transaction address.	
	pv::AccessWidth getAccessWidth() const; // Request width.
	int getAccessByteWidth() const;         // Request width in bytes.	
	int getAccessBitWidth() const;          // Request width in bits.

	bool isPrivileged() const;  // Privileged process mode?	
	bool isInstruction() const; // Instruction request vs data?
	bool isNonSecure() const;   // Normal-world vs secure-world?	
	bool isLocked() const;      // Atomic locked access?	
	bool isExclusive() const;   // Atomic exclusive access?
	uint32_t getMasterID() const;
	bool hasSideEffect() const;

	// Generate transaction returns

	Tx_Result  generateAbort();          // Cause the transaction to abort
	Tx_Result  generateSlaveAbort();     // Cause the transaction to abort
	Tx_Result  generateDecodeAbort();    // Cause the transaction to abort
	Tx_Result  generateExclusiveAbort(); // Cause the transaction to abort
	Tx_Result	 	 generateIgnore();

Class pv::ReadTransaction

The pv::ReadTransaction extends the pv::Transaction class to provide methods for returning data from a bus read request.

class ReadTransaction : public Transaction 
	/*! Return a 64-bit value on the bus. 	*/
	Tx_Result setReturnData64(uint64_t);

	/*! Return a 32-bit value on the bus. 	*/
	Tx_Result setReturnData32(uint32_t);

	/*! Return a 16-bit value on the bus. 	*/
	Tx_Result setReturnData16(uint16_t);

	/*! Return an 8-bit value on the bus. 	*/
	Tx_Result setReturnData8(uint8_t);

	/*! This method provides an alternative way of returning a Tx_Result
	* success value (instead of just using the value returned from
	* setReturnData<n>()).	
	* This method can only be called if one of the setReturnData<n>
	* methods has already been called for the current transaction.	
	Tx_Result readComplete();

Class pv::WriteTransaction

The pv::WriteTransaction extends the pv::Transaction class to provide methods for returning data from a bus write request.

class WriteTransaction : public Transaction 
	/*! Get bottom 64-bits of data from the bus. If the transaction width	
	* is less than 64-bits, the data will be extended as appropriate.	
	uint64_t getData64() const;

	/*! Get bottom 32-bits of data from the bus. If the transaction width	
	* is less than 32-bits, the data will be extended as appropriate.	
	uint32_t getData32() const;

	/*! Get bottom 16-bits of data from the bus. If the transaction width
	* is less than 16-bits, the data will be extended as appropriate.
	uint16_t getData16() const;

	/*! Get bottom 8-bits of data from the bus. If the transaction width
	* is less than 8-bits, the data will be extended as appropriate.
	uint8_t getData8() const;

	/*! Signal that the slave has handled the write successfully.
	Tx_Result writeComplete();
Copyright © 2008-2013 ARM. All rights reserved.ARM DUI 0423O