Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / model / vendor / TLM-2006-11-29 / tlm / tlm_bus_analysis.h
CommitLineData
86530b38
AT
1
2#ifndef TLM_BUS_ANALYSIS_HEADER
3#define TLM_BUS_ANALYSIS_HEADER
4
5#include "analysis.h"
6#include "tlm_bus.h"
7
8//
9// This file disables analysis_fifo ( and analysis_buffer, when we've done
10// that ) for ptr versions of tlm_request, tlm_response, and the analysis
11// triple versions of those data structures
12//
13// We also provide widgets to convert from the by ptr version to the by val
14// version
15//
16
17namespace analysis {
18
19 using tlm_bus::tlm_request;
20 using tlm_bus::tlm_response;
21
22 using tlm_bus::TLM_PASS_BY_COPY;
23 using tlm_bus::TLM_PASS_BY_POINTER;
24
25 template< typename ADDRESS , typename DATA>
26 class analysis_fifo<
27 tlm_bus::tlm_request< ADDRESS , DATA , tlm_bus::TLM_PASS_BY_POINTER >
28 > {};
29
30 template< typename DATA>
31 class analysis_fifo<
32 tlm_bus::tlm_response< DATA , tlm_bus::TLM_PASS_BY_POINTER >
33 > {};
34
35 template< typename ADDRESS , typename DATA>
36 class analysis_fifo<
37 analysis_triple<
38 tlm_bus::tlm_request< ADDRESS , DATA , tlm_bus::TLM_PASS_BY_POINTER >
39 >
40 > {};
41
42 template< typename DATA>
43 class analysis_fifo<
44 analysis_triple<
45 tlm_bus::tlm_response< DATA , tlm_bus::TLM_PASS_BY_POINTER >
46 >
47 > {};
48
49 template< typename FROM , typename TO >
50 class standard_converter {
51 public:
52 static TO convert( const FROM &from ) { return from; }
53 };
54
55 template< typename FROM , typename TO ,
56 typename CONVERTER = standard_converter<FROM,TO> >
57 class analysis_converter :
58 public sc_module ,
59 public virtual analysis_if< FROM > ,
60 public virtual analysis_if< analysis_triple< FROM > > {
61
62 analysis_port< TO > ap;
63 analysis_port< analysis_triple< TO > > triple_ap;
64
65 analysis_converter( sc_module_name nm ) :
66 sc_module( nm ) ,
67 ap("ap") ,
68 triple_ap("triple_ap") {}
69
70 void write( const analysis_triple<FROM> &t ) {
71 TO to_val = CONVERTER( t );
72
73 triple_ap.write( analysis_triple<TO>( t.start_time ,
74 to_val ,
75 t.from_time ) );
76 ap.write( to_val );
77
78 }
79
80 void write( const FROM &f ) {
81 ap.write( CONVERTER::convert( f ) );
82 }
83
84 };
85
86};
87#endif