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

Subversion Repositories ahb2wishbone

[/] [ahb2wishbone/] [trunk/] [svtb/] [avm_svtb/] [ahb_wb_responder.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_responder.svh
6
//Designer              :       Sanjay kumar
7
//Date                  :       3rd Aug'2007
8
//Description           :       ahb_wb_responder:Class to respond for the request sent by AHB Master and to generate
9
//                              wait state by Wishbone slave.
10
//Revision              :       1.0
11
//*****************************************************************************************************************
12
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
13
 
14
import avm_pkg::*;
15
import global::*;
16
 
17
class ahb_wb_responder extends avm_threaded_component;
18
 
19
int cnt;
20
virtual ahb_wb_if pin_if;
21
 
22
        function new(string name ,avm_named_component parent);
23
                super.new(name,parent);
24
                pin_if   =null;
25
        endfunction
26
 
27
 
28
task run;
29
        forever
30
                begin
31
                        @(pin_if.slave_bw.adr_o or pin_if.slave_bw.we_o);
32
                                if(!pin_if.master_ab.hresetn)
33
                                        begin
34
                                        pin_if.slave_bw.ack_i='b0;
35
                                        pin_if.slave_bw.dat_i='bx;
36
                                        end
37
                                else
38
                                         if(! pin_if.slave_bw.we_o)
39
                                                pin_if.slave_bw.dat_i=pin_if.slave_bw.adr_o;
40
                end
41
endtask
42
 
43
// wait state asserted by slave
44
task wait_state_by_slave;
45
        pin_if.slave_bw.ack_i='b1;
46
        do
47
                begin
48
                @(posedge pin_if.master_ab.hclk);
49
                cnt++;
50
                end
51
        while (cnt <= 7);
52
 
53
        #2 pin_if.slave_bw.ack_i='b0; // 8 clock cycle asserted
54
        //avm_report_message("Responder: Wait state asserted in Write mode ","by slave");
55
        cnt=0;
56
        do
57
                begin
58
                @(posedge pin_if.master_ab.hclk);
59
                cnt++;
60
                end
61
        while (cnt <= 4);
62
        #2 pin_if.slave_bw.ack_i='b1; // 5 clock cycle deasserted
63
        //avm_report_message("Responder: Wait state deasserted in write mode ","by slave");
64
        cnt=0;
65
        do
66
                begin
67
                @(posedge pin_if.master_ab.hclk);
68
                cnt++;
69
                end
70
        while (cnt <= 44);
71
 
72
        #2 pin_if.slave_bw.ack_i='b0; // 25 clock cycle asserted
73
        //avm_report_message("Responder: Wait state asserted in Read mode ","by slave");
74
        cnt=0;
75
        do
76
                begin
77
                @(posedge pin_if.master_ab.hclk);
78
                cnt++;
79
                end
80
        while (cnt <= 4);
81
        #2 pin_if.slave_bw.ack_i='b1; // 5 clock cycle  deasserted
82
        //avm_report_message("Responder: Wait state deasserted in Read mode ","by slave");
83
endtask
84
 
85
 
86
endclass
87
 
88
 
89
 

powered by: WebSVN 2.1.0

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