thekaradi

APB_UVM_TB_TOP

Feb 4th, 2025 (edited)
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module apb_tb_top;
  2.  
  3.     import uvm_pkg::*;
  4.     `include "uvm_macros.svh"
  5.  
  6.     import apb_pkg::*;
  7.  
  8.     // Clock generation
  9.     bit PCLK;
  10.     parameter CYCLE = 10;
  11.  
  12.     initial begin
  13.         forever #(CYCLE/2) PCLK = ~PCLK;
  14.     end
  15.  
  16.     // Parameters
  17.     parameter SET_DATA_WIDTH = 8;
  18.     parameter SET_ADDR_WIDTH = 8;
  19.  
  20.     // Wires
  21.     logic PWRITE_w;
  22.     logic [(SET_DATA_WIDTH-1):0] PWDATA_w;
  23.     logic [(SET_ADDR_WIDTH-1):0] PADDR_w;
  24.     logic PREADY_w;
  25.     logic PSLVERR_w;
  26.     logic [(SET_DATA_WIDTH-1):0] PRDATA_w;
  27.  
  28.     // Interface instantiation
  29.     apb_mst_intf mst_if0 (PCLK);
  30.  
  31.     apb_slv_intf #(.DATA_WIDTH(SET_DATA_WIDTH), .ADDR_WIDTH(SET_ADDR_WIDTH)) slv_if0 (.PCLK(PCLK));
  32.     // Connecting the slave intf with the wires
  33.     assign slv_if0.PWRITE   = PWRITE_w;
  34.     assign slv_if0.PREADY   = PREADY_w;
  35.  
  36.     apb_slv_intf #(.DATA_WIDTH(SET_DATA_WIDTH), .ADDR_WIDTH(SET_ADDR_WIDTH)) slv_if1 (.PCLK(PCLK));
  37.     // Connecting the slave intf with the wires
  38.     assign slv_if1.PWRITE   = PWRITE_w;
  39.     assign slv_if1.PREADY   = PREADY_w;
  40.  
  41.     // DUV Instantiation
  42.     apb_master #(.DATA_WIDTH(SET_DATA_WIDTH), .ADDR_WIDTH(SET_ADDR_WIDTH)) DUV (
  43.         .PCLK(PCLK),
  44.         .PRESETN(mst_if0.PRESETN),
  45.         .BWRITE(mst_if0.BWRITE),
  46.         .BWDATA(mst_if0.BWDATA),
  47.         .BADDR(mst_if0.BADDR),
  48.         .BSEL0(mst_if0.BSEL0),
  49.         .BSEL1(mst_if0.BSEL1),
  50.         .PENABLE(PENABLE_w),
  51.         .PWRITE(PWRITE_w),
  52.         .PWDATA(PWDATA_w),
  53.         .PADDR(PADDR_w),
  54.         .PSEL0(slv_if0.PSEL),
  55.         .PSEL1(slv_if1.PSEL),
  56.         .PREADY(PREADY_w),
  57.         .PSLVERR(PSLVERR_w),
  58.         .PRDATA(PRDATA_w)
  59.     );
  60.  
  61.     initial begin
  62.         run_test();
  63.     end
  64.  
  65. endmodule: apb_tb_top
Advertisement
Add Comment
Please, Sign In to add comment