source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Shifter/src/Shifter.cpp @ 42

Last change on this file since 42 was 42, checked in by rosiere, 17 years ago

Modification des classes d'encapsulation des interfaces :

  • gère les signaux à écrire dans le vhdl
  • les traces pour le testbench
  • la génération des vhdl structurelles

-> test sur la Pattern History Table

File size: 2.7 KB
Line 
1/*
2 * $Id$
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Generic/Shifter/include/Shifter.h"
9
10namespace morpheo                    {
11namespace behavioural {
12namespace generic {
13namespace shifter {
14
15
16#ifdef SYSTEMC
17  Shifter::Shifter (sc_module_name name
18#else
19  Shifter::Shifter (string name
20#endif
21#ifdef STATISTICS
22                    ,morpheo::behavioural::Parameters_Statistics             param_statistics
23#endif
24                    ,morpheo::behavioural::generic::shifter::Parameters param ):
25                    _name   (name)
26                    ,_param (param)
27  {
28#ifdef SYSTEMC
29    allocation ();
30#endif
31
32#ifdef STATISTICS
33    // Allocation of statistics
34    _stat = new Statistics (static_cast<string>(_name),
35                            param_statistics          ,
36                            param);
37#endif
38
39#ifdef VHDL
40    // generate the vhdl
41    vhdl();
42#endif
43
44#ifdef SYSTEMC
45#if (defined(STATISTICS) || defined (VHDL_TESTBENCH))
46    SC_METHOD (transition);
47    dont_initialize ();
48    sensitive_pos << *(in_CLOCK);
49#endif
50
51    SC_METHOD (genMealy_shift);
52    dont_initialize ();
53    sensitive_neg << *(in_CLOCK);
54    for (uint32_t i=0; i<param._nb_port; i++)
55      {
56        sensitive << (*(in_SHIFTER_DATA      [i]));
57        if (param._shift_value == 0)
58        sensitive << (*(in_SHIFTER_SHIFT     [i]));
59        if (param._direction   == external_direction)
60        sensitive << (*(in_SHIFTER_DIRECTION [i]));
61        if (_param._rotate     == external_rotate)
62        sensitive << (*(in_SHIFTER_TYPE      [i]));
63        if (param._carry       == external_carry)
64        sensitive << (*(in_SHIFTER_CARRY     [i]));
65        if (param._carry       == external_completion)
66          if (_param._type_completion_bool == true)
67            sensitive << (*(in_SHIFTER_CARRY_IN  [i]));
68          else
69            sensitive << (*(in_SHIFTER_COMPLETION[i]));
70      }
71
72#ifdef SYSTEMCASS_SPECIFIC
73    // List dependency information
74    for (uint32_t i=0; i<param._nb_port; i++)
75      {
76        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_DATA      [i]));
77        if (param._shift_value == 0)
78        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_SHIFT     [i]));
79        if (param._direction   == external_direction)
80        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_DIRECTION [i]));
81        if (_param._rotate     == external_rotate)
82        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_TYPE      [i]));
83        if (param._carry       == external_carry)
84        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_CARRY     [i]));
85        if (param._carry       == external_completion)
86        if (_param._type_completion_bool == true)
87        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_CARRY_IN  [i]));
88        else
89        (*(out_SHIFTER_DATA [i])) (*(in_SHIFTER_COMPLETION[i]));
90      }
91#endif   
92
93#endif
94  };
95 
96  Shifter::~Shifter (void)
97  {
98#ifdef SYSTEMC
99    deallocation ();
100#endif
101
102#ifdef STATISTICS
103    _stat->generate_file(statistics(0));
104   
105    delete _stat;
106#endif
107  };
108
109}; // end namespace shifter
110}; // end namespace generic
111
112}; // end namespace behavioural
113}; // end namespace morpheo             
Note: See TracBrowser for help on using the repository browser.