EDA Playground lets you type in and run HDL code (using a selection of free and commercial simulators and synthesizers).
It's great for learning HDLs, it's great for testing out unfamiliar things and it's great for sharing code.
You can start typing straight away. But to run your code, you'll need to sign or log in. Logging in with a Google account gives you access to all non-commercial simulators and some commercial simulators:
To run commercial simulators, you need to register and log in with a username and password. Registration is free, and only pre-approved email's will have access to the commercial simulators.
204
DOULOS EASIER UVM CODE GENERATOR
------ ------ --- ---- ---------
By clicking on the Enable Easier UVM checkbox, you have enabled access to the Doulos Easier UVM Code Generator. The Easier UVM Code Generator enables you to generate UVM testbenches from simple control files and snippets of SystemVerilog code.
The control files specify the testbench. You will always need at least three control files:
- a Common Template File, which is the master file for code generation,
- at least one Interface Template File, one per interface, and
- a pinlist file, which specifies which DUT pins are connected to which interface variables.
The snippets of SystemVerilog code allow you to customize the test bench to your specific requirements, e.g. to drive the pins of each interface to the design under test (DUT).
To get started, take a look at the examples listed in the Examples section on the left of the EDA Playground window. You can access the full set of reference documentation, tutorials, and videos by clicking on the blue i next to the Enable Easier UVM checkbox.
You can download the generated code by clicking on the Download files after run checkbox.
Easier UVM on EDA Playground is a great way to get started with UVM: you can generate and run working UVM testbench code quickly and easily on EDA Playground. Alternatively, you can download the Easier UVM Code Generator to run on your own computer by clicking on the blue i next to the Enable Easier UVM checkbox.
DIFFERENCES WHEN RUNNING THE CODE GENERATOR IN EDA PLAYGROUND
To get the Easier UVM Code Generator working in EDA Playground, we have had to make some changes. If you already use the Easier UVM Code Generator, here are some things you need to know:
- Template files, the pinlist file, include files and any regmodel file have to be created as EDA Playground testbench tabs (on the left)
- DUT files have to be created as EDA Playground design tabs (on the right)
- Template files must have the file extension .tpl, include files and DUT files must have the file extension .sv
- The default design tab is named design.sv. This tab may contain DUT code or may be empty. Either way, you may add further design tabs.
- Optionally, you can add an EDA Playground design tab named files.f that lists the other design tabs/files in the order they are to be compiled. If absent, all the design tabs will be compiled in alphabetical order.
- It is not possible to pass command line arguments to the generator script, so the Common Template File must be named common.tpl, and the only way to specify a prefix is using the prefix setting in common.tpl
- The dut_source_path and inc_path settings in common.tpl are unnecessary in EDA Playground (because the files are created as tabs and identified from their file extensions). If the settings are present, their values do not affect the generated code.
- The dut_pfile setting in common.tpl must not include a hierarchical directory path (because the pinlist file is created as a tab). The default is dut_pfile = pinlist.
xxxxxxxxxx
dut_top = mydut
regmodel_file = dummy.sv
top_reg_block_type = top_reg_block
xxxxxxxxxx
agent_name = bus
trans_item = bus_tx
trans_var = rand bit cmd;
trans_var = rand byte addr;
trans_var = rand byte data;
driver_inc = bus_do_drive.sv inline
if_port = logic clk;
if_port = bit cmd;
if_port = byte addr;
if_port = byte data;
if_clock = clk
reg_access_mode = WR
reg_access_block_type = bus_reg_block
uvm_reg_kind = cmd
uvm_reg_addr = addr
uvm_reg_data = data
reg_seq_inc = bus_env_reg_seq.sv inline
agent_factory_set = bus_env_default_seq bus_env_reg_seq
xxxxxxxxxx
!bus_if
bus_clk clk
bus_cmd cmd
bus_addr addr
bus_data data
xxxxxxxxxx
task bus_driver::do_drive();
vif.cmd = req.cmd;
vif.addr = req.addr;
vif.data = req.data;
@(posedge vif.clk);
endtask
xxxxxxxxxx
`ifndef BUS_ENV_REG_SEQ_SV
`define BUS_ENV_REG_SEQ_SV
class bus_env_reg_seq extends bus_env_default_seq;
`uvm_object_utils(bus_env_reg_seq)
function new(string name = "");
super.new(name);
endfunction : new
task body();
regmodel.reg0.write(status, .value('hab), .parent(this));
assert(status == UVM_IS_OK);
regmodel.reg0.write(status, .value('hcd), .parent(this));
assert(status == UVM_IS_OK);
regmodel.reg0.write(status, .value('hef), .parent(this));
assert(status == UVM_IS_OK);
regmodel.reg0.read(status, .value(data), .parent(this));
assert(status == UVM_IS_OK);
endtask: body
endclass : bus_env_reg_seq
`endif
xxxxxxxxxx
class dummy_reg extends uvm_reg;
`uvm_object_utils(dummy_reg)
rand uvm_reg_field F;
function new(string name = "");
super.new(name, 8, UVM_NO_COVERAGE);
endfunction
virtual function void build();
F = uvm_reg_field::type_id::create("F");
F.configure(this, 8, 0, "RW", 1, 8'h00, 1, 1, 1);
endfunction
endclass
class bus_reg_block extends uvm_reg_block;
`uvm_object_utils(bus_reg_block)
rand dummy_reg reg0;
uvm_reg_map bus_map;
function new(string name = "");
super.new(name, UVM_NO_COVERAGE);
endfunction
virtual function void build();
reg0 = dummy_reg::type_id::create("reg0");
reg0.configure(this);
reg0.build();
bus_map = create_map("bus_map", 'h0, 1, UVM_LITTLE_ENDIAN);
default_map = bus_map;
bus_map.add_reg(reg0, 'h0, "RW");
lock_model();
endfunction
endclass
class top_reg_block extends uvm_reg_block;
`uvm_object_utils(top_reg_block)
bus_reg_block bus;
uvm_reg_map bus_map;
function new(string name = "");
super.new(name, UVM_NO_COVERAGE);
endfunction
virtual function void build();
bus = bus_reg_block::type_id::create("bus");
bus.configure(this);
bus.build();
bus_map = create_map("bus_map", 'h0, 1, UVM_LITTLE_ENDIAN);
default_map = bus_map;
bus_map.add_submap(bus.bus_map, 'h0);
lock_model();
endfunction
endclass
xxxxxxxxxx
// This needs to contain the top-level of the DUT
// or it can be left blank
module mydut (input logic bus_clk,
input bit bus_cmd,
input byte bus_data,
input byte bus_addr);
always @(posedge bus_clk)
$display("@%4d mydut bus_cmd = %s, bus_addr = %h, bus_data = %h", $time, (bus_cmd ? "W" : "R"), bus_addr, bus_data);
endmodule
Your account is not validated. If you wish to use commercial simulators, you need a validated account.
If you have already registered (or have recently changed your email address), but have not clicked on the link in the email we sent you, please do so. If you cannot find the email, please check your spam/junk folder. Or click here to resend the email.
If you have not already registered for a full account, you can do so by clicking below. You will then need to provide us with some identification information. You may wish to save your code first.
Creating, deleting, and renaming files is not supported during Collaboration. To encourage development of these features for Collaboration, tweet to @EDAPlayground
This playground may have been modified. Please save or copy before starting collaboration.
Your exercise has been submitted.