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

Subversion Repositories ahb2wishbone

[/] [ahb2wishbone/] [branches/] [toomuch/] [svtb/] [avm_svtb/] [ahb_wb_stim_gen.svh] - Blame information for rev 5

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 toomuch
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
2
//*****************************************************************************************************************
3
// Copyright (c) 2007 TooMuch Semiconductor Solutions Pvt Ltd.
4
//
5
//File name             :       ahb_wb_stim_gen.svh
6
//Designer              :       Sanjay kumar
7
//Date                  :       3rd Aug'2007
8
//Description           :       ahb_wb_stim_gen:Class to generata write and read packet with wait state by master.
9
//Revision              :       1.0
10
//*****************************************************************************************************************
11
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
12
 
13
import avm_pkg::*;
14
import global::*;
15
 
16
class ahb_wb_stim_gen extends avm_named_component;
17
 
18
// communication port
19
avm_blocking_put_port#( ahb_req_pkt) initiator_port;
20
tlm_fifo #(ahb_req_pkt) fifo;
21
 
22
        function new(string name ,avm_named_component parent);
23
                super.new(name,parent);
24
                initiator_port=new("initiatot_port",this);
25
                fifo =new("fifo",this);
26
        endfunction
27
 
28
task stimulus(input int count= 45);
29
        ahb_req_pkt p;
30
        //(write operation) write data and addr. to fifo
31
                for(int i=0; i
32
                begin
33
                        if(i>15 && i<21)// busy  mode
34
                                begin
35
                                p.mode='b01;
36
                                p.wr='b1;
37
                                end
38
                        else if(i>26 && i<31) // idle mode
39
                                begin
40
                                p.mode='b00;
41
                                p.wr='b1;
42
                                end
43
                        else if(i>30 && i<36) // Sequential mode
44
                                begin
45
                                p.mode='b11;
46
                                p.wr='b1;
47
                                end
48
                        else    // Non sequential mode
49
                                begin
50
                                p.mode='b10;
51
                                p.adr=$random;
52
                                p.dat=$random;
53
                                p.wr='b1;
54
                                end
55
                write_to_pipe(p);
56
                end
57
        //(read operation) write address to fifo for read
58
                for(int i=0; i
59
                begin
60
                        if(i>10 && i<16) // busy mode
61
                                begin
62
                                p.mode='b01;
63
                                p.wr='b0;
64
                                end
65
                        else if(i>20 && i<26) // idle mode
66
                                begin
67
                                p.mode='b00;
68
                                p.wr='b0;
69
                                end
70
                        else if(i>25 && i<31) // Sequential mode
71
                                begin
72
                                p.mode='b11;
73
                                p.wr='b0;
74
                                end
75
                        else //Non Sequential mode
76
                                begin
77
                                p.mode='b10;
78
                                p.adr=$random;
79
                                p.wr='b0;
80
                                end
81
                write_to_pipe(p);
82
                end
83
        // write operation
84
                for(int i=0; i<(count-30) ;i++)
85
                begin
86
                        if(i>=0 && i<(count-30))
87
                                begin
88
                                p.mode='b10;
89
                                p.adr=$random;
90
                                p.dat=$random;
91
                                p.wr='b1;
92
                                end
93
                write_to_pipe(p);
94
                end
95
endtask
96
 
97
// task to push transaction in the fifo
98
task write_to_pipe(ahb_req_pkt p);
99
                initiator_port.put(p);
100
               //avm_report_message("Stim_gen: Packet pushed into fifo",global::convert2string(p));
101
 
102
endtask
103
 
104
 
105
endclass

powered by: WebSVN 2.1.0

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