25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.1 KiB

  1. // Class: axi_write_seq
  2. //
  3. class axi_write_seq#(D_WIDTH = 16, int A_WIDTH = 16) extends uvm_sequence;
  4. `uvm_object_param_utils(axi_write_seq#(D_WIDTH, A_WIDTH));
  5. // Group: Variables
  6. const int no_of_trans;
  7. bit[7:0] id;
  8. axi_transaction#(D_WIDTH, A_WIDTH) trans;
  9. test_config test_cfg;
  10. // Constructor: new
  11. function new(string name = "axi_write_seq");
  12. super.new(name);
  13. test_cfg = new("test_cfg");
  14. if(!uvm_config_db#(test_config)::get(null, "uvm_test_top.seq", "config", test_cfg))
  15. `uvm_fatal(get_name(), "config cannot be found in ConfigDB!")
  16. no_of_trans = test_cfg.no_write_cases;
  17. endfunction: new
  18. // Task: body
  19. // This is the user-defined task where the main sequence code resides.
  20. extern virtual task body();
  21. endclass: axi_write_seq
  22. task axi_write_seq::body();
  23. repeat(no_of_trans) begin
  24. id++;
  25. trans = axi_transaction#(D_WIDTH, A_WIDTH)::type_id::create("trans");
  26. if(test_cfg.isAligned) begin
  27. trans.addr_val_align.constraint_mode(1);
  28. trans.addr_val_unalign.constraint_mode(0);
  29. trans.addr_val.constraint_mode(0);
  30. end
  31. else if (!test_cfg.isAligned) begin
  32. trans.addr_val_align.constraint_mode(0);
  33. trans.addr_val_unalign.constraint_mode(1);
  34. trans.addr_val.constraint_mode(0);
  35. end
  36. else begin
  37. trans.addr_val_align.constraint_mode(0);
  38. trans.addr_val_unalign.constraint_mode(0);
  39. trans.addr_val.constraint_mode(1);
  40. end
  41. start_item(trans);
  42. if(test_cfg.burst_type == 0)
  43. assert(trans.randomize() with { b_type == FIXED; });
  44. else if(test_cfg.burst_type == 1)
  45. assert(trans.randomize() with { b_type == INCR; });
  46. else if(test_cfg.burst_type == 2)
  47. assert(trans.randomize() with { b_type == WRAP; addr==16'h80c6;write==1;});
  48. else
  49. assert(trans.randomize());
  50. trans.id = {1'b0, id};
  51. finish_item(trans);
  52. trans.print();
  53. #10;
  54. end
  55. endtask: body