day71 - EDA Playground
Warning! This exercise has been opened in another tab; autosave has been disabled. Close this tab or refresh to reactivate.

 Languages & Libraries

 Tools & Simulators

 Examples

205


34
 
1
`include "uvm_macros.svh"
2
3
import uvm_pkg::*;
4
5
class apb_slave_basic_seq extends uvm_sequence;
6
  
7
  `uvm_object_utils(apb_slave_basic_seq);
8
  
9
  // Number of transactions to be sent
10
  rand int num_txn;
11
  
12
  function new (string name="apb_slave_basic_seq");
13
    super.new(name);
14
  endfunction
15
  
16
  // Allow anywhere betweeen 20-100 APB transactions
17
  constraint apb_num_txn {num_txn inside {[100:500]}; }
18
  
19
  // Generate the item in the body
20
  virtual task body();
21
    string tx;
22
    for (int i=0; i<num_txn; i++) begin
23
      apb_slave_item seq_item = apb_slave_item::type_id::create("seq_item");
24
      `uvm_info("SEQUENCE", "Starting a new APB Slave item", UVM_LOW);
25
      start_item(seq_item);
26
      void'(seq_item.randomize());
27
      tx = seq_item.tx2string();
28
      `uvm_info("SEQUENCE", $sformatf("Generated a new APB Slave item:\n%s", tx), UVM_LOW);
29
      finish_item(seq_item);
30
    end
31
    `uvm_info("SEQUENCE", "Finished sending APB Slave items", UVM_LOW);
32
  endtask
33
  
34
endclass
24
 
1
interface apb_slave_if (
2
  input     logic       clk,
3
  input     logic       reset
4
);
5
  
6
  logic         psel;
7
  logic         penable;
8
  logic [9:0]   paddr;
9
  logic         pwrite;
10
  logic [31:0]  pwdata;
11
  logic         pready;
12
  logic [31:0]  prdata;
13
  
14
  
15
  clocking cb @(posedge clk);
16
    input       psel;
17
    input       penable;
18
    input       paddr;
19
    input       pwrite;
20
    input       pwdata;
21
    inout       pready;
22
    inout       prdata;
23
  endclocking
24
endinterface
99 views and 0 likes     
A short description will be helpful for you to remember your playground's details
 
100:0