1 | #ifndef morpheo_behavioural_generic_shifter_Shifter_h |
---|
2 | #define morpheo_behavioural_generic_shifter_Shifter_h |
---|
3 | |
---|
4 | /* |
---|
5 | * $Id$ |
---|
6 | * |
---|
7 | * [ Description ] |
---|
8 | * |
---|
9 | */ |
---|
10 | |
---|
11 | #ifdef SYSTEMC |
---|
12 | #include "systemc.h" |
---|
13 | #endif |
---|
14 | |
---|
15 | #include <iostream> |
---|
16 | #include "Include/ToString.h" |
---|
17 | |
---|
18 | #include "Behavioural/Generic/Shifter/include/Parameters.h" |
---|
19 | #include "Behavioural/Generic/Shifter/include/Types.h" |
---|
20 | #ifdef STATISTICS |
---|
21 | #include "Behavioural/Generic/Shifter/include/Statistics.h" |
---|
22 | #endif |
---|
23 | #ifdef VHDL |
---|
24 | #include "Behavioural/include/Vhdl.h" |
---|
25 | #endif |
---|
26 | #ifdef VHDL_TESTBENCH |
---|
27 | #include "Behavioural/include/Vhdl_Testbench.h" |
---|
28 | #endif |
---|
29 | |
---|
30 | using namespace std; |
---|
31 | |
---|
32 | namespace morpheo { |
---|
33 | namespace behavioural { |
---|
34 | namespace generic { |
---|
35 | namespace shifter { |
---|
36 | |
---|
37 | |
---|
38 | class Shifter |
---|
39 | #if SYSTEMC |
---|
40 | : public sc_module |
---|
41 | #endif |
---|
42 | { |
---|
43 | // -----[ fields ]---------------------------------------------------- |
---|
44 | // Parameters |
---|
45 | protected : const string _name; |
---|
46 | |
---|
47 | protected : const Parameters _param; |
---|
48 | #ifdef STATISTICS |
---|
49 | private : Statistics * _stat; |
---|
50 | #endif |
---|
51 | |
---|
52 | #ifdef VHDL_TESTBENCH |
---|
53 | private : Vhdl_Testbench * _vhdl_testbench; |
---|
54 | #endif |
---|
55 | |
---|
56 | #ifdef SYSTEMC |
---|
57 | // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
58 | public : SC_CLOCK * in_CLOCK ; |
---|
59 | // Interface "shifter" |
---|
60 | public : SC_IN (Tdata_t) ** in_SHIFTER_DATA ; |
---|
61 | public : SC_IN (Tshift_t) ** in_SHIFTER_SHIFT ; |
---|
62 | public : SC_IN (Tdirection_t) ** in_SHIFTER_DIRECTION ; |
---|
63 | public : SC_IN (Ttype_t) ** in_SHIFTER_TYPE ; |
---|
64 | public : SC_IN (Tcarry_t) ** in_SHIFTER_CARRY ; |
---|
65 | public : SC_IN (Tcontrol_t) ** in_SHIFTER_CARRY_IN ; // Completion == type bool |
---|
66 | public : SC_IN (Tdata_t) ** in_SHIFTER_COMPLETION; // Completion != type bool |
---|
67 | public : SC_OUT(Tdata_t) ** out_SHIFTER_DATA ; |
---|
68 | |
---|
69 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
70 | |
---|
71 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
72 | #endif |
---|
73 | |
---|
74 | // -----[ methods ]--------------------------------------------------- |
---|
75 | |
---|
76 | #ifdef SYSTEMC |
---|
77 | SC_HAS_PROCESS (Shifter); |
---|
78 | #endif |
---|
79 | |
---|
80 | public : Shifter ( |
---|
81 | #ifdef SYSTEMC |
---|
82 | sc_module_name name, |
---|
83 | #else |
---|
84 | string name, |
---|
85 | #endif |
---|
86 | #ifdef STATISTICS |
---|
87 | morpheo::behavioural::Parameters_Statistics param_statistics, |
---|
88 | #endif |
---|
89 | Parameters param ); |
---|
90 | |
---|
91 | public : Shifter (Parameters param ); |
---|
92 | public : ~Shifter (void); |
---|
93 | |
---|
94 | #ifdef SYSTEMC |
---|
95 | private : void allocation (void); |
---|
96 | private : void deallocation (void); |
---|
97 | |
---|
98 | #if (defined(STATISTICS) || defined (VHDL_TESTBENCH)) |
---|
99 | public : void transition (void); |
---|
100 | #endif |
---|
101 | public : void genMealy_shift (void); |
---|
102 | #endif |
---|
103 | |
---|
104 | #if VHDL |
---|
105 | public : void vhdl (void); |
---|
106 | private : void vhdl_port (Vhdl & vhdl); |
---|
107 | private : void vhdl_declaration (Vhdl & vhdl); |
---|
108 | private : void vhdl_body (Vhdl & vhdl); |
---|
109 | #endif |
---|
110 | #ifdef STATISTICS |
---|
111 | public : string statistics (uint32_t depth); |
---|
112 | #endif |
---|
113 | |
---|
114 | #ifdef VHDL_TESTBENCH |
---|
115 | private : void vhdl_testbench (Vhdl_Testbench & vhdl_testbench); |
---|
116 | private : void vhdl_testbench_port (Vhdl_Testbench & vhdl_testbench); |
---|
117 | private : void vhdl_testbench_transition (Vhdl_Testbench & vhdl_testbench); |
---|
118 | #endif |
---|
119 | |
---|
120 | }; |
---|
121 | |
---|
122 | }; // end namespace shifter |
---|
123 | }; // end namespace generic |
---|
124 | |
---|
125 | }; // end namespace behavioural |
---|
126 | }; // end namespace morpheo |
---|
127 | |
---|
128 | #endif |
---|