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.

7 月之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. //write sequence
  2. class axi_wr_seq extends uvm_sequence #(axi_seq_item);
  3. `uvm_object_utils(axi_wr_seq)
  4. seq_item txn;
  5. function new(string name="axi_wr_seq");
  6. super.new(name);
  7. endfunction
  8. task body();
  9. txn=seq_item::type_id::create(txn);
  10. start_item(txn);
  11. assert(txn.randomize() with {txn.write==1;txn.awaddr==0x04;txn.wdata==0x2b1a;});
  12. finish_item(txn);
  13. endtask
  14. endclass
  15. //read sequence
  16. class axi_rd_seq extends uvm_sequence #axi_(seq_item);
  17. `uvm_object_utils(axi_rd_seq)
  18. seq_item txn;
  19. function new(string name="axi_rd_seq");
  20. super.new(name);
  21. endfunction
  22. task body();
  23. txn=seq_item::type_id::create(txn);
  24. start_item(txn);
  25. assert(txn.randomize() with {txn.write==0;txn.araddr==0x04;});
  26. finish_item(txn);
  27. endtask
  28. endclass
  29. //unaligned sequence
  30. class axi_rd_seq extends uvm_sequence #(axi_seq_item);
  31. `uvm_object_utils(axi_rd_seq)
  32. seq_item txn;
  33. function new(string name="axi_rd_seq");
  34. super.new(name);
  35. endfunction
  36. task body();
  37. txn=seq_item::type_id::create(txn);
  38. // if(txn.awaddr%2**awsize!=0)
  39. // begin
  40. txn.aligned_addr.constraint_mode(0);
  41. // end
  42. start_item(txn);
  43. assert(txn.randomize() with {txn.write==1;txn.awaddr==0x07;txn.awsize==3;});
  44. finish_item(txn);
  45. endtask
  46. endclass
  47. //locked access sequence
  48. class axi_locked_access_seq extends uvm_sequence #(axi_seq_item);
  49. `uvm_object_utils(axi_locked_acess_seq)
  50. seq_item txn;
  51. function new(string name="axi_locked_access_seq");
  52. super.new(name);
  53. endfunction
  54. task body();
  55. begin
  56. txn=seq_item::type_id::create(txn);
  57. start_item(txn);
  58. assert(txn.randomize() with {txn.write==1;txn.awaddr==0x04;txn.awlock==2'b10;txn.awid==01;});
  59. finish_item(txn);
  60. end
  61. begin
  62. txn=seq_item::type_id::create(txn);
  63. start_item(txn);
  64. assert(txn.randomize() with {txn.write==1;txn.awaddr==0x04;txn.awlock==2'b10;txn.awid==02;});
  65. finish_item(txn);
  66. end
  67. endtask
  68. endclass
  69. //write read sequence
  70. class axi_rd_seq extends uvm_sequence #(axi_seq_item);
  71. `uvm_object_utils(axi_rd_seq)
  72. seq_item txn;
  73. axi_wr_seq wr_seq;
  74. axi_rd_seq rd_seq;
  75. function new(string name="axi_rd_seq");
  76. super.new(name);
  77. endfunction
  78. task body();
  79. begin
  80. txn=seq_item::type_id::create(txn);
  81. `uvm_do(wr_seq);
  82. `uvm_do(rd_seq);
  83. end
  84. endtask
  85. endclass