1 |
4 |
toomuch |
//////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// //
|
3 |
|
|
// Verification Engineer: Atish Jaiswal //
|
4 |
|
|
// Company Name : TooMuch Semiconductor Solutions Pvt Ltd. //
|
5 |
|
|
// //
|
6 |
|
|
// Description of the Source File: //
|
7 |
|
|
// This file defines Stimulus packet class for Scenario Generator. //
|
8 |
|
|
// The Packet Randomizes intr_en to enable/disable interrupt, byte_count to transfer //
|
9 |
|
|
// Random no. of data_bytes, register_address and data for register testcase. It also //
|
10 |
|
|
// randomize slave address. Other fields get assigned in Scenario generator class. //
|
11 |
|
|
// Constraint block called reg_add is used to contrain randomized fields. //
|
12 |
|
|
// //
|
13 |
|
|
// //
|
14 |
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
15 |
|
|
|
16 |
|
|
`include "vmm.sv"
|
17 |
|
|
|
18 |
|
|
class stimulus_packet extends vmm_data;
|
19 |
|
|
|
20 |
|
|
vmm_log log;
|
21 |
|
|
|
22 |
|
|
rand bit intr_en ; // 1 for Interrupt enable and 0 for disable
|
23 |
|
|
rand int byte_count; // no. of bytes to be transfered
|
24 |
|
|
rand bit [7:0] register_data; // to check register read/write
|
25 |
|
|
rand bit [7:0] register_addr; // to select the address of internal register
|
26 |
|
|
rand bit [6:0] slave_address; // slave address to be checked
|
27 |
|
|
bit [7:0] data_packet[]; // data packets to be transfered
|
28 |
|
|
bit master_slave; // 1 for master and 0 for slave
|
29 |
|
|
bit tr; // 1 for trasmit and 0 for receive
|
30 |
|
|
bit register_check; // 1 to check registers writing and 0 for not.
|
31 |
|
|
bit reset_check; // 1 to check reset test and 0 for not.
|
32 |
|
|
int temp_count;
|
33 |
|
|
|
34 |
|
|
constraint reg_add {
|
35 |
|
|
register_addr inside {8'h02, 8'h04, 8'h0A, 8'h0C, 8'h0E};
|
36 |
|
|
byte_count inside {[2:10]};
|
37 |
|
|
slave_address < 7'b111_1111;
|
38 |
|
|
intr_en dist {0 := 1, 1 :=1};
|
39 |
|
|
}
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
function new();
|
43 |
|
|
super.new(this.log);
|
44 |
|
|
this.log = new("Stimulus Data", "class");
|
45 |
|
|
endfunction
|
46 |
|
|
|
47 |
|
|
function void display();
|
48 |
|
|
this.log.start_msg(vmm_log::NOTE_TYP);
|
49 |
|
|
void'(this.log.text($psprintf("Master/Slave mode is = %b\n", master_slave)));
|
50 |
|
|
void'(this.log.text($psprintf("tr = %d\n", tr)));
|
51 |
|
|
void'(this.log.text($psprintf("register_check = %b\n", register_check)));
|
52 |
|
|
void'(this.log.text($psprintf("reset_check = %b\n", reset_check)));
|
53 |
|
|
void'(this.log.text($psprintf("Interrupt Enable is = %b\n", intr_en)));
|
54 |
|
|
void'(this.log.text($psprintf("byte_count = %d\n", byte_count)));
|
55 |
|
|
void'(this.log.text($psprintf("register_addr = %b\n", register_addr)));
|
56 |
|
|
void'(this.log.text($psprintf("register_data = %b\n", register_data)));
|
57 |
|
|
void'(this.log.text($psprintf("slave_address = %b\n", slave_address)));
|
58 |
|
|
this.log.end_msg();
|
59 |
|
|
temp_count = byte_count;
|
60 |
|
|
endfunction
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
function vmm_data copy(vmm_data to = null);
|
64 |
|
|
copy = new this;
|
65 |
|
|
endfunction
|
66 |
|
|
|
67 |
|
|
endclass
|
68 |
|
|
`vmm_channel(stimulus_packet) // This macro defined in VMM Methodology creates channel named stimulus_packet_channel
|
69 |
|
|
|