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

Subversion Repositories ahb2wishbone

[/] [ahb2wishbone/] [trunk/] [svtb/] [avm_svtb/] [ahb_wb_driver.svh] - Blame information for rev 10

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_driver.svh
6
//Designer              :       Sanjay kumar
7
//Date                  :       3rd Aug'2007
8
//Description           :       ahb_wb_driver:Class to receive packets from the tlm fifo and passed it to the
9
//                              interface of the AHB to Wishbone bridge.
10
//Revision              :       1.0
11
//*****************************************************************************************************************
12
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
13
 
14
import avm_pkg::*;
15
import global::*;
16
 
17
class ahb_wb_driver extends avm_threaded_component;
18
 
19
// communication ports
20
avm_nonblocking_get_port #(ahb_req_pkt) request_port;
21
tlm_fifo #(ahb_req_pkt) fifo;
22
 
23
virtual ahb_wb_if pin_if;
24
 
25
        function new(string name ,avm_named_component parent);
26
                super.new(name,parent);
27
                request_port =new("request_port",this);
28
                fifo =new("fifo",this);
29
                pin_if   =null;
30
        endfunction
31
 
32
task run;
33
        ahb_req_pkt req;
34
        ahb_res_pkt res;
35
        forever
36
                begin
37
                        @(posedge pin_if.master_ab.hclk);
38
                                        if(pin_if.master_ab.hready && pin_if.master_ab.hresetn)
39
                                                begin
40
                                                        if(request_port.try_get(req))
41
                                                        write_to_bus(req);
42
                                                end
43
                end
44
endtask
45
 
46
 
47
// write data to bus
48
virtual task write_to_bus(input ahb_req_pkt req);
49
                #2      pin_if.master_ab.htrans=req.mode;
50
                        pin_if.master_ab.hwrite=req.wr;
51
                        pin_if.master_ab.haddr =req.adr;
52
                        pin_if.master_ab.hwdata=req.dat;
53
                        //avm_report_message("Driver:Packet on interface",global::convert2string(req));
54
endtask
55
 
56
endclass
57
 
58
 
59
 

powered by: WebSVN 2.1.0

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