You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 line
3.0 KiB

  1. `include "uvm_macros.svh"
  2. import uvm_pkg::*;
  3. class axi_seq_item extends uvm_sequence_item;
  4. //`uvm_object_utils(axi_seq_item)
  5. function new(string name="axi_seq_item");
  6. super.new(name);
  7. endfunction
  8. //write address signals
  9. rand bit write;
  10. rand logic [31:0] awaddr;
  11. rand bit [3:0] awid;
  12. rand logic [3:0] awlen;
  13. rand logic [2:0] awsize;
  14. rand logic [1:0] awburst;
  15. rand logic [1:0] awlock;
  16. //write data signals
  17. rand bit [3:0] wid;
  18. rand logic [31:0] wdata[][];
  19. logic [3:0] wstrb;
  20. logic wlast;
  21. //write response signals
  22. rand bit [3:0] Bid;
  23. logic [1:0] Bresp;
  24. //read address signals
  25. rand logic [31:0] araddr;
  26. rand bit [3:0] arid;
  27. rand logic [3:0] arlen;
  28. rand logic [2:0] arsize;
  29. rand logic [1:0] arburst;
  30. rand logic [1:0] arlock;
  31. //read data signals
  32. rand bit [3:0] rid;
  33. rand logic [31:0] rdata[][];
  34. logic [3:0] rresp;
  35. rand logic rlast;
  36. `uvm_object_utils_begin(axi_seq_item)
  37. `uvm_field_int(awid,UVM_ALL_ON)
  38. `uvm_field_int(awaddr,UVM_ALL_ON)
  39. `uvm_field_int(awsize,UVM_ALL_ON)
  40. `uvm_field_int(awlen,UVM_ALL_ON)
  41. `uvm_field_int(awburst,UVM_ALL_ON)
  42. `uvm_field_int(awlock,UVM_ALL_ON)
  43. `uvm_field_int(awvalid,UVM_ALL_ON)
  44. `uvm_field_int(awready,UVM_ALL_ON)
  45. `uvm_field_int(wid,UVM_ALL_ON)
  46. `uvm_field_int(wdata,UVM_ALL_ON)
  47. `uvm_field_int(wlast,UVM_ALL_ON)
  48. `uvm_field_int(wstrb,UVM_ALL_ON)
  49. `uvm_field_int(wvalid,UVM_ALL_ON)
  50. `uvm_field_int(wready,UVM_ALL_ON)
  51. `uvm_field_int(Bid,UVM_ALL_ON)
  52. `uvm_field_int(Bresp,UVM_ALL_ON)
  53. `uvm_field_int(Bvalid,UVM_ALL_ON)
  54. `uvm_field_int(Bready,UVM_ALL_ON)
  55. `uvm_field_int(arid,UVM_ALL_ON)
  56. `uvm_field_int(araddr,UVM_ALL_ON)
  57. `uvm_field_int(arsize,UVM_ALL_ON)
  58. `uvm_field_int(arlen,UVM_ALL_ON)
  59. `uvm_field_int(arsize,UVM_ALL_ON)
  60. `uvm_field_int(arburst,UVM_ALL_ON)
  61. `uvm_field_int(arlock,UVM_ALL_ON)
  62. `uvm_field_int(arvalid,UVM_ALL_ON)
  63. `uvm_field_int(arready,UVM_ALL_ON)
  64. `uvm_field_int(rid,UVM_ALL_ON)
  65. `uvm_field_int(rdata,UVM_ALL_ON)
  66. `uvm_field_int(rlast,UVM_ALL_ON)
  67. `uvm_field_int(rresp,UVM_ALL_ON)
  68. `uvm_field_int(rvalid,UVM_ALL_ON)
  69. `uvm_field_int(rready,UVM_ALL_ON)
  70. `uvm_object_utils_end
  71. //constraints for axi
  72. //axi 4kb boundary
  73. constraint axi_4kb {awaddr%4096+(2**awsize*(awlen+1))<=4096;}
  74. //constarint for exclusive access
  75. constraint exclusive_access {
  76. if(awlock==2'b01)
  77. awlen inside{1,3,7,15};}
  78. // aligned addr
  79. constraint aligned_addr {awaddr%2**awsize==0;}
  80. //wrap addr
  81. constraint wrap_addr {
  82. if(awburst==2'b 10)
  83. awlen inside{1,3,7,15};}
  84. //id's should be same
  85. constraint wid_awid {awid==wid;}
  86. //id's should be same
  87. constraint rid_awid {arid==rid;}
  88. endclass