OpenCores
URL https://opencores.org/ocsvn/openhmc/openhmc/trunk

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [sim/] [tb/] [common/] [testlib/] [openhmc_check_seq.sv] - Blame information for rev 15

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 15 juko
/*
2
 *                              .--------------. .----------------. .------------.
3
 *                             | .------------. | .--------------. | .----------. |
4
 *                             | | ____  ____ | | | ____    ____ | | |   ______ | |
5
 *                             | ||_   ||   _|| | ||_   \  /   _|| | | .' ___  || |
6
 *       ___  _ __   ___ _ __  | |  | |__| |  | | |  |   \/   |  | | |/ .'   \_|| |
7
 *      / _ \| '_ \ / _ \ '_ \ | |  |  __  |  | | |  | |\  /| |  | | || |       | |
8
 *       (_) | |_) |  __/ | | || | _| |  | |_ | | | _| |_\/_| |_ | | |\ `.___.'\| |
9
 *      \___/| .__/ \___|_| |_|| ||____||____|| | ||_____||_____|| | | `._____.'| |
10
 *           | |               | |            | | |              | | |          | |
11
 *           |_|               | '------------' | '--------------' | '----------' |
12
 *                              '--------------' '----------------' '------------'
13
 *
14
 *  openHMC - An Open Source Hybrid Memory Cube Controller
15
 *  (C) Copyright 2014 Computer Architecture Group - University of Heidelberg
16
 *  www.ziti.uni-heidelberg.de
17
 *  B6, 26
18
 *  68159 Mannheim
19
 *  Germany
20
 *
21
 *  Contact: openhmc@ziti.uni-heidelberg.de
22
 *  http://ra.ziti.uni-heidelberg.de/openhmc
23
 *
24
 *   This source file is free software: you can redistribute it and/or modify
25
 *   it under the terms of the GNU Lesser General Public License as published by
26
 *   the Free Software Foundation, either version 3 of the License, or
27
 *   (at your option) any later version.
28
 *
29
 *   This source file is distributed in the hope that it will be useful,
30
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
31
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
32
 *   GNU Lesser General Public License for more details.
33
 *
34
 *   You should have received a copy of the GNU Lesser General Public License
35
 *   along with this source file.  If not, see .
36
 *
37
 *
38
 */
39
 
40
`ifndef openhmc_check_seq
41
`define openhmc_check_seq
42
 
43
 
44
class openhmc_check_seq extends hmc_base_seq;
45
 
46
        function new(string name="openhmc_check_seq");
47
                super.new(name);
48
        endfunction : new
49
 
50
        `uvm_object_utils(openhmc_check_seq)
51
        `uvm_declare_p_sequencer(vseqr)
52
 
53
        int timer;
54
        int q_size, q_size_prev;
55
        int draintime = 200;
56
 
57
        task body();
58
                reg_openhmc_rf_status_general_c status;
59
                reg_openhmc_rf_sent_np_c sent_np;
60
                reg_openhmc_rf_rcvd_rsp_c rcvd_rsp;
61
 
62
                `uvm_info(get_type_name(), "Running Check Sequence", UVM_NONE)
63
 
64
                timer = 0;
65
                q_size_prev = 0;
66
 
67
                $cast(status,p_sequencer.rf_seqr_hmc.get_by_name("status_general"));
68
                status.set_check_on_read(1'b0);
69
 
70
                $cast(sent_np,p_sequencer.rf_seqr_hmc.get_by_name("sent_np"));
71
                sent_np.set_check_on_read(1'b0);
72
 
73
                $cast(rcvd_rsp,p_sequencer.rf_seqr_hmc.get_by_name("rcvd_rsp"));
74
                rcvd_rsp.set_check_on_read(1'b0);
75
 
76
                p_sequencer.rf_seqr_hmc.read_reg(status);
77
                p_sequencer.rf_seqr_hmc.read_reg(sent_np);
78
                p_sequencer.rf_seqr_hmc.read_reg(rcvd_rsp);
79
 
80
 
81
                while(
82
                                ((p_sequencer.scb.axi4_np_requests.size() ) ||
83
                                (status.fields.rx_tokens_remaining_ != ((p_sequencer.link_cfg.cfg_rsp_open_loop==UVM_ACTIVE) ? status.fields.rx_tokens_remaining_ :p_sequencer.link_cfg.rx_tokens)) ||
84
                                (status.fields.hmc_tokens_remaining_ != p_sequencer.link_cfg.hmc_tokens) )
85
                                &&
86
                                (timer < draintime)
87
                ) begin
88
                        #1us;
89
                        p_sequencer.rf_seqr_hmc.read_reg(status);
90
                        p_sequencer.rf_seqr_hmc.read_reg(sent_np);
91
                        p_sequencer.rf_seqr_hmc.read_reg(rcvd_rsp);
92
 
93
                        if(p_sequencer.link_cfg.cfg_rsp_open_loop==UVM_ACTIVE)
94
                                `uvm_info(get_type_name(), "OPEN RESPONSE LOOP MODE. openHMC tokens not checked.", UVM_NONE)
95
                        else
96
                                `uvm_info(get_type_name(),$psprintf("RX token count in TX_LINK = %0d, should be %0d", status.fields.rx_tokens_remaining_, p_sequencer.link_cfg.rx_tokens),UVM_LOW)
97
 
98
                        q_size = p_sequencer.scb.axi4_np_requests.size();
99
                        `uvm_info(get_type_name(), $psprintf("Scoreboard open response queue size = %d",q_size) , UVM_NONE)
100
                        `uvm_info(get_type_name(),$psprintf("HMC token count in TX_LINK = %0d, should be %0d", status.fields.hmc_tokens_remaining_, p_sequencer.link_cfg.hmc_tokens),UVM_LOW)
101
                        `uvm_info(get_type_name(),$psprintf("sent = %0d non-posted packets, received %0d responses", sent_np.fields.cnt_, rcvd_rsp.fields.cnt_),UVM_LOW)
102
 
103
                        if(q_size==q_size_prev) begin
104
                                timer++;
105
                        end else begin
106
                                timer=0;
107
                        end
108
                        q_size_prev = q_size;
109
 
110
                end
111
                #1us;
112
 
113
                p_sequencer.rf_seqr_hmc.read_reg(status);
114
                p_sequencer.rf_seqr_hmc.read_reg(sent_np);
115
                p_sequencer.rf_seqr_hmc.read_reg(rcvd_rsp);
116
 
117
                #5us;
118
 
119
                //-- ***REPORTS***
120
                //-- Report Packet Counts
121
                if( timer==draintime ) begin
122
                        `uvm_info(get_type_name(),$psprintf("Counted: %0d NP Requests, %0d Responses", sent_np.fields.cnt_, rcvd_rsp.fields.cnt_), UVM_LOW)
123
                        `uvm_info(get_type_name(),$psprintf("Responder token count in TX_LINK = %0d, should be %0d", status.fields.hmc_tokens_remaining_, p_sequencer.link_cfg.hmc_tokens), UVM_LOW)
124
                        `uvm_fatal(get_type_name(),$psprintf("Requester token count in TX_LINK = %0d, should be %0d", status.fields.rx_tokens_remaining_, p_sequencer.link_cfg.rx_tokens))
125
                end
126
 
127
        endtask : body
128
 
129
endclass : openhmc_check_seq
130
 
131
`endif // openhmc_check_seq

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.