Code Browser Pages:
| //////////////////////////////////////////////// ////s~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~s//// ////s www.testbench.in s//// ////s s//// ////s VMM Tutorial s//// ////s s//// ////s gopi@testbench.in s//// ////s~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~s//// //////////////////////////////////////////////// `include "vmm.sv" class instruction extends vmm_data; vmm_log log; typedef enum {LOAD__A,LOAD__B,ADD_A_B,SUB_A_B,STORE_C } kinds_e; rand kinds_e inst; function new(); super.new(this.log); endfunction:new virtual function string psdisplay(string prefix = ""); psdisplay = $psprintf(" Instruction : | stream_id : 0 | scenario_id : 0 ",inst.name(),stream_id,scenario_id); endfunction:psdisplay virtual function vmm_data allocate(); instruction tr = new; allocate = tr; endfunction:allocate virtual function vmm_data copy(vmm_data cpy = null); instruction to; // Copying to a new instance? if (cpy == null) to = new; else // Copying to an existing instance. Correct type? if (!$cast(to, cpy)) begin `vmm_fatal(this.log, "Attempting to copy to a non instruction instance"); return null; end super.copy_data(to); to.inst = this.inst; copy = to; endfunction:copy endclass `vmm_channel(instruction) |