My Transaction class definition is as below.
class cmd_xtn extends uvm_sequence_item;
`uvm_object_utils(cmd_xtn)
// the below 9 are the valid commands (cmd)
/* parameter LDA = 4'b0000, // loading the register A with some data
LDB = 4'b0001, // loading the register B with some data
OUTA = 4'b0010, // places the contents of Register A on the output bus
MVBA = 4'b0011, // copies the contents of Register B into A.
MVFA = 4'b0100, // copies the contents of Flag register to Register A
ADD = 4'b0101, // add the contents of A and B and puts the result in Reg A
SUB = 4'b0110,
AND = 4'b0111,
OR = 4'b1000,
LDMR = 4'b1001; // Load the mode register with some data. */
/* Addresses of my registers are reg_A ---> 8'h00
reg_B ---> 8'h01
mode_reg ---> 8'h02
flag_reg ---> 8'h03 */
rand bit [3:0] cmd;
rand bit [3:0] data;
rand bit rst;
static int no_of_xtns;
constraint valid_cmd {cmd inside {[0:9]};}
constraint reset {rst dist {1:=10, 0:=90};}
constraint mode_reg {if(cmd == 9)
data inside {[0:1]};
else
data inside {[0:15]};}
extern function new(string name = "cmd_xtn");
extern function void disp();
extern function void post_randomize();
endclass
So, there is no specific address field in my transaction class.
And some commands like MVBA and MVFA will read from one register and write into another register. So, how to define adapter class (reg2bus & bus2reg methods) for this kind of transaction?