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

61 lines
2.1 KiB

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