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

Subversion Repositories openhmc

[/] [openhmc/] [trunk/] [openHMC/] [sim/] [UVC/] [axi4_stream/] [sv/] [axi4_stream_master_sequence.sv] - Blame information for rev 12

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 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 AXI4_STREAM_MASTER_SEQUENCE_SV
41
`define AXI4_STREAM_MASTER_SEQUENCE_SV
42
 
43
class axi4_stream_master_sequence extends uvm_sequence;
44
 
45
        rand int delay;
46
        rand hmc_packet response;
47
        rand bit error_response;
48
    event item_available;
49
 
50
        hmc_packet response_queue[$];
51
 
52
        constraint delay_c {
53
                delay dist {0:=4, [0:9]:=8, [10:30]:=2, [31:100]:=1};
54
        }
55
 
56
        `uvm_object_utils(axi4_stream_master_sequence)
57
 
58
        `uvm_declare_p_sequencer(axi4_stream_master_sequencer)
59
 
60
        function new(string name="axi4_stream_master_sequence");
61
                super.new(name);
62
        endfunction : new
63
 
64
        task body();
65
 
66
                void'(this.randomize());
67
 
68
                fork
69
                        // Convert requests to responses
70
                        forever begin : tranlsate_loop
71
                                hmc_packet packet;
72
                                p_sequencer.req_mailbox.get(packet);
73
                                create_response_packet(packet);
74
                        end : tranlsate_loop
75
 
76
                        //
77
                        begin
78
                                hmc_packet packet;
79
 
80
                                forever begin : send_loop
81
 
82
                                        if (response_queue.size() > 0) begin
83
                                                int time_to_wait;
84
 
85
                                                time_to_wait = response_queue[0].timestamp - $time;
86
                                                if (time_to_wait <= 0) begin
87
                                                        packet = response_queue.pop_front();
88
                                                        uvm_report_info(get_type_name(), $psprintf("Sending response packet: %s", packet.command.name()), UVM_HIGH);
89
                                                        `uvm_send(packet)
90
                                                end else begin
91
                                                        #time_to_wait;
92
                                                end
93
                                        end
94
                                        else begin
95
                                                // Wait for items to get added to the queue
96
                                                if (response_queue.size() == 0)
97
                                                        @(item_available);
98
                                        end
99
 
100
                                end : send_loop
101
                        end
102
                join
103
 
104
        endtask : body
105
 
106
endclass : axi4_stream_master_sequence
107
 
108
`endif // AXI4_STREAM_MASTER_SEQUENCER_SV
109
 

powered by: WebSVN 2.1.0

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