1 |
2 |
HanySalah |
//-----------------------------------------------------------------------------
|
2 |
|
|
//
|
3 |
|
|
// UART2BUS VERIFICATION
|
4 |
|
|
//
|
5 |
|
|
//-----------------------------------------------------------------------------
|
6 |
|
|
// CREATOR : HANY SALAH
|
7 |
|
|
// PROJECT : UART2BUS UVM TEST BENCH
|
8 |
|
|
// UNIT : ANALYSIS
|
9 |
|
|
//-----------------------------------------------------------------------------
|
10 |
|
|
// TITLE : UART ANALYSIS
|
11 |
|
|
// DESCRIPTION: This
|
12 |
|
|
//-----------------------------------------------------------------------------
|
13 |
|
|
// LOG DETAILS
|
14 |
|
|
//-------------
|
15 |
|
|
// VERSION NAME DATE DESCRIPTION
|
16 |
|
|
// 1 HANY SALAH 22012016 FILE CREATION
|
17 |
|
|
//-----------------------------------------------------------------------------
|
18 |
|
|
// ALL COPYRIGHTS ARE RESERVED FOR THE PRODUCER ONLY .THIS FILE IS PRODUCED FOR
|
19 |
|
|
// OPENCORES MEMBERS ONLY AND IT IS PROHIBTED TO USE THIS MATERIAL WITHOUT THE
|
20 |
|
|
// CREATOR'S PERMISSION
|
21 |
|
|
//-----------------------------------------------------------------------------
|
22 |
|
|
class uart_scoreboard extends uvm_scoreboard;
|
23 |
|
|
|
24 |
|
|
uvm_tlm_analysis_fifo #(uart_transaction) mon_fifo;
|
25 |
|
|
|
26 |
|
|
uvm_analysis_export #(uart_transaction) scbd_mon;
|
27 |
|
|
|
28 |
|
|
uvm_tlm_analysis_fifo #(uart_transaction) drv_fifo;
|
29 |
|
|
|
30 |
|
|
uvm_analysis_export #(uart_transaction) scbd_drv;
|
31 |
|
|
|
32 |
|
|
uart_transaction frm_drv,frm_drv_tmp;
|
33 |
|
|
|
34 |
|
|
uart_transaction frm_mon,frm_mon_tmp;
|
35 |
|
|
|
36 |
|
|
`uvm_component_utils(uart_scoreboard)
|
37 |
|
|
|
38 |
|
|
function new (string name , uvm_component parent);
|
39 |
|
|
super.new(name,parent);
|
40 |
|
|
endfunction:new
|
41 |
|
|
|
42 |
|
|
extern function void build_phase (uvm_phase phase);
|
43 |
|
|
|
44 |
|
|
extern function void connect_phase (uvm_phase phase);
|
45 |
|
|
|
46 |
|
|
extern task run_phase (uvm_phase phase);
|
47 |
|
|
endclass:uart_scoreboard
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
function void uart_scoreboard::build_phase (uvm_phase phase);
|
51 |
|
|
super.build_phase(phase);
|
52 |
|
|
|
53 |
|
|
frm_drv = uart_transaction::type_id::create("frm_drv");
|
54 |
|
|
frm_drv_tmp = uart_transaction::type_id::create("frm_drv_tmp");
|
55 |
|
|
|
56 |
|
|
frm_mon = uart_transaction::type_id::create("frm_mon");
|
57 |
|
|
frm_mon_tmp = uart_transaction::type_id::create("frm_mon_tmp");
|
58 |
|
|
|
59 |
|
|
mon_fifo = new ("mon_fifo",this);
|
60 |
|
|
scbd_mon = new ("scbd_mon",this);
|
61 |
|
|
|
62 |
|
|
drv_fifo = new ("drv_fifo",this);
|
63 |
|
|
scbd_drv = new ("scbd_drv",this);
|
64 |
|
|
|
65 |
|
|
endfunction:build_phase
|
66 |
|
|
|
67 |
|
|
function void uart_scoreboard::connect_phase (uvm_phase phase);
|
68 |
|
|
scbd_mon.connect(mon_fifo.analysis_export);
|
69 |
|
|
scbd_drv.connect(drv_fifo.analysis_export);
|
70 |
|
|
endfunction:connect_phase
|
71 |
|
|
|
72 |
|
|
task uart_scoreboard::run_phase (uvm_phase phase);
|
73 |
|
|
int iteration;
|
74 |
|
|
iteration = 0;
|
75 |
|
|
forever
|
76 |
|
|
begin
|
77 |
|
|
iteration++;
|
78 |
|
|
drv_fifo.get(frm_drv_tmp);
|
79 |
|
|
$cast(frm_drv,frm_drv_tmp.clone());
|
80 |
|
|
mon_fifo.get(frm_mon_tmp);
|
81 |
|
|
$cast(frm_mon,frm_mon_tmp.clone());
|
82 |
|
|
|
83 |
|
|
if (frm_drv._mode != frm_mon._mode)
|
84 |
|
|
begin
|
85 |
|
|
`uvm_fatal("Testbench Bug",$sformatf("Modes aren't similiar .. @time=%0t, It was requested to use %p mode and the applied mode is %p ",$time,frm_drv._mode,frm_mon._mode))
|
86 |
|
|
end
|
87 |
|
|
else
|
88 |
|
|
begin
|
89 |
|
|
case (frm_drv._mode)
|
90 |
|
|
text:
|
91 |
|
|
begin
|
92 |
|
|
if(frm_drv._command != frm_mon._command)
|
93 |
|
|
begin
|
94 |
|
|
`uvm_fatal("Testbench Bug",$sformatf("Commands aren't identical .. @time=%0t, It was requested to drive %p command and the applied command is %p ",$time,frm_drv._command,frm_mon._command))
|
95 |
|
|
end
|
96 |
|
|
else
|
97 |
|
|
begin
|
98 |
|
|
case(frm_drv._command)
|
99 |
|
|
read:
|
100 |
|
|
begin
|
101 |
|
|
if (frm_drv._data != frm_mon._data)
|
102 |
|
|
begin
|
103 |
|
|
`uvm_error("Failed Read Text Mode",$sformatf("Data fields aren't identical ,, @time=%0t It was requested to drive %p and dut reply with the data %p",$time,frm_drv._data,frm_mon._data))
|
104 |
|
|
end
|
105 |
|
|
else if((frm_drv._data == frm_mon._data) &&
|
106 |
|
|
(frm_drv.address == frm_mon.address) &&
|
107 |
|
|
(frm_drv._spacetype1 == frm_mon._spacetype1) &&
|
108 |
|
|
(frm_drv._eoltype == frm_mon._eoltype) &&
|
109 |
|
|
(frm_drv._chartype == frm_mon._chartype))
|
110 |
|
|
begin
|
111 |
|
|
`uvm_info("Passed Read Text Mode",$sformatf("Data fields are identical ,, @time=%0t It was requested to read from the address %h and dut reply with the data %p using white space = %p and %p prefix character and %p as end of line character",$time,frm_drv.address,frm_mon._data,frm_drv._spacetype1,frm_drv._chartype,
|
112 |
|
|
frm_drv._eoltype),UVM_NONE)
|
113 |
|
|
end
|
114 |
|
|
else
|
115 |
|
|
begin
|
116 |
|
|
`uvm_error("Failed Read Text Mode",$sformatf("@time=%0t .. It is Requested to request to read data = %p address of %h with character prefix : %p using white space = %p and end of line character %p .. and found data = %p and address=%h with character prefix : %p using white space = %p and end of line character %p",$time, frm_drv._data,frm_drv.address,frm_drv._chartype,frm_drv._spacetype1,frm_drv._eoltype,
|
117 |
|
|
frm_mon._data,frm_mon.address,frm_mon._chartype,frm_mon._spacetype1,frm_mon._eoltype))
|
118 |
|
|
end
|
119 |
|
|
end
|
120 |
|
|
write:
|
121 |
|
|
begin
|
122 |
|
|
if (frm_drv._data != frm_mon._data)
|
123 |
|
|
begin
|
124 |
|
|
`uvm_error("Failed Write Text Mode",$sformatf("Data fields aren't identical ,, @time=%0t It was requested to drive %p and dut register the data %p",$time,frm_drv._data,frm_mon._data))
|
125 |
|
|
end
|
126 |
|
|
else if((frm_drv._data == frm_mon._data) &&
|
127 |
|
|
(frm_drv.address == frm_mon.address) &&
|
128 |
|
|
(frm_drv._spacetype1 == frm_mon._spacetype1) &&
|
129 |
|
|
(frm_drv._eoltype == frm_mon._eoltype) &&
|
130 |
|
|
(frm_drv._chartype == frm_mon._chartype))
|
131 |
|
|
begin
|
132 |
|
|
`uvm_info("Passed write Text Mode",$sformatf("Data fields are identical ,, @time=%0t It was requested to write to the address %h and dut register the data %p using white space = %p and %p prefix character and %p as end of line character",$time,frm_drv.address,frm_mon._data,frm_drv._spacetype1,frm_drv._chartype,
|
133 |
|
|
frm_drv._eoltype),UVM_NONE)
|
134 |
|
|
end
|
135 |
|
|
else
|
136 |
|
|
begin
|
137 |
|
|
`uvm_error("Failed write Text Mode",$sformatf("@time=%0t .. It is Requested to request to write data = %p address of %h with character prefix : %p using white space = %p and end of line character %p .. and found data = %p and address=%h with character prefix : %p using white space = %p and end of line character %p",$time, frm_drv._data,frm_drv.address,frm_drv._chartype,frm_drv._spacetype1,frm_drv._eoltype,
|
138 |
|
|
frm_mon._data,frm_mon.address,frm_mon._chartype,frm_mon._spacetype1,frm_mon._eoltype))
|
139 |
|
|
end
|
140 |
|
|
|
141 |
|
|
end
|
142 |
|
|
default:
|
143 |
|
|
begin
|
144 |
|
|
`uvm_fatal("Testbench Bug",$sformatf("@time = %0t .. It isn't allowablt to drive %p command through text mode",$time,frm_drv._command))
|
145 |
|
|
end
|
146 |
|
|
endcase
|
147 |
|
|
end
|
148 |
|
|
end
|
149 |
|
|
binary:
|
150 |
|
|
begin
|
151 |
|
|
|
152 |
|
|
end
|
153 |
|
|
wrong_mode:
|
154 |
|
|
begin
|
155 |
|
|
|
156 |
|
|
end
|
157 |
|
|
default:
|
158 |
|
|
begin
|
159 |
|
|
`uvm_fatal("Testbench Bug",$sformatf("Mode is undefined = %p",frm_drv._mode))
|
160 |
|
|
end
|
161 |
|
|
endcase
|
162 |
|
|
end
|
163 |
|
|
end
|
164 |
|
|
endtask:run_phase
|