Facebook/LinkedIn login is now deprecated, please disconnect our access to your social profile.
User dashboard under chipverify.com/connect will be deprecated from Oct 1, 2020, Read More.
Let us contribute to a cleaner Earth, Go Green Updated: May 31, 2020

AMBA AHB is a widely used bus protocol by the company ARM Holdings, typically used to transfer data between different masters and slaves. This is a pipelined protocol with a much higher performance in terms of latency and bandwidth compared to APB.

AHB Lite is a smaller version of the AHB with a smaller feature set, but has support for burst transactions, slave wait states, and protection control signals.

AHB Sequence Item

The sequence item has all relevant signals for the AHB protocol that will decide the kind of transfer a master initiates. The first step is to define enum data types so that code is easily understood. Most of the AHB signals can be randomized to have certain valid combinations of signals and sent to an AHB driver to be driven over to the DUT.

typedef enum bit [1:0] { IDLE, BUSY, NONSEQ, SEQ } e_htrans;
typedef enum bit [2:0] { BYTE, HALF_WORD, WORD, WORD_2, WORD_4, WORD_8, WORD_16, WORD_32} e_hsize;
typedef enum bit [2:0] { SINGLE, INCR, WRAP4, INCR4, WRAP8, INCR8, WRAP16, INCR16 } e_hburst;
typedef enum bit 	   { OKAY, ERROR } e_hresp;
typedef enum bit 	   { READ, WRITE } e_hwrite;

class ahb_pkt extends uvm_sequence_item;  
  function new(string name = "ahb_pkt");
  rand  bit [15:0] 	m_haddr;
  rand  e_hburst 	m_hburst;
  rand	bit 		m_hmastlock;
  rand 	e_hprot 	m_hprot;
  rand 	e_hsize 	m_hsize;
  rand 	e_htrans 	m_htrans;
  rand 	bit [31:0] 	m_hwdata;
  rand 	e_hwrite	m_hwrite;
  		bit [31:0] 	m_hrdata;
  		e_hresp 	m_hresp;
  	`uvm_field_int 	(m_haddr,  				UVM_PRINT)
  	`uvm_field_enum (e_hburst, m_hburst, 	UVM_PRINT)
  	`uvm_field_int 	(m_hmastlock, 			UVM_PRINT)
  	`uvm_field_enum (e_hprot, m_hprot, 		UVM_PRINT)
  	`uvm_field_enum (e_hsize, m_hsize, 		UVM_PRINT)
  	`uvm_field_enum (e_htrans, m_htrans, 	UVM_PRINT)
  	`uvm_field_int 	(m_hwdata, 				UVM_PRINT)
  	`uvm_field_enum (e_hwrite, m_hwrite, 	UVM_PRINT)
  	`uvm_field_int 	(m_hrdata, 				UVM_PRINT)
  	`uvm_field_enum (e_hresp, m_hresp, 		UVM_PRINT)
  constraint c_default { m_htrans == NONSEQ;
                         m_hsize == WORD;
                         m_hburst == SINGLE; }
  virtual function string convert2string();
    return $sformatf("addr=0x%0h write=0x%0h wdata=0x%0h rdata=0x%0h",
                     m_haddr, m_hwrite, m_hwdata, m_hrdata);


Login to your free account to read more ...

You consent to our cookies if you continue to use our website. To know more about cookies, see our privacy policy. I accept cookies from this site.