source: trunk/IPs/systemC/Environment/include/Environment.h @ 117

Last change on this file since 117 was 117, checked in by rosiere, 15 years ago

1) Platforms : add new organization for test
2) Load_Store_Unit : add array to count nb_check in store_queue
3) Issue_queue and Core_Glue : rewrite the issue network
4) Special_Register_Unit : add reset value to register CID
5) Softwares : add multicontext test
6) Softwares : add SPECINT
7) Softwares : add MiBench?
7) Read_queue : inhib access for r0
8) Change Core_Glue (network) - dont yet support priority and load balancing scheme

  • Property svn:keywords set to Id
File size: 7.0 KB
Line 
1#ifndef ENVIRONMENT_H
2#define ENVIRONMENT_H
3
4#include "../Common/include/Debug.h"
5#include "../Cache/include/Cache.h"
6#include "../Data/include/Data.h"
7#include "../Endianness/include/Endianness.h"
8#include "../Queue/include/Sort_Queue.h"
9#include "../RamLock/include/RamLock.h"
10#include "../Sim2OS/include/Sim2OS.h"
11#include "../TTY/include/TTY.h"
12#include "../../processor/Morpheo/Common/include/Max.h"
13
14#include "Types.h"
15#include "Environment_Parameters.h"
16#include "Respons.h"
17#include "Cache_Access.h"
18
19#include <systemc.h>
20
21namespace environment {
22
23  typedef Respons<morpheo::Ticache_context_t, morpheo::Ticache_packet_t,morpheo::Ticache_error_t> irsp_t;
24  typedef Respons<morpheo::Tdcache_context_t, morpheo::Tdcache_packet_t,morpheo::Tdcache_error_t> drsp_t;
25
26  class Environment : public sc_module
27  {
28    // ===== [ Ports ]=======================================================
29  public : sc_in_clk                        * CLOCK                 ;
30  public : sc_in<bool>                      * NRESET                ;
31
32  public : sc_in <morpheo::Tcontrol_t           >  *** ICACHE_REQ_VAL        ;//[nb_entity][icache_dedicated_nb_port]
33  public : sc_out<morpheo::Tcontrol_t           >  *** ICACHE_REQ_ACK        ;//[nb_entity][icache_dedicated_nb_port]
34  public : sc_in <morpheo::Ticache_context_t    >  *** ICACHE_REQ_CONTEXT_ID ;//[nb_entity][icache_dedicated_nb_port]
35  public : sc_in <morpheo::Ticache_packet_t     >  *** ICACHE_REQ_PACKET_ID  ;//[nb_entity][icache_dedicated_nb_port]
36  public : sc_in <morpheo::Ticache_address_t    >  *** ICACHE_REQ_ADDRESS    ;//[nb_entity][icache_dedicated_nb_port]
37  public : sc_in <morpheo::Ticache_type_t       >  *** ICACHE_REQ_TYPE       ;//[nb_entity][icache_dedicated_nb_port]
38
39  public : sc_out<morpheo::Tcontrol_t           >  *** ICACHE_RSP_VAL        ;//[nb_entity][icache_dedicated_nb_port]
40  public : sc_in <morpheo::Tcontrol_t           >  *** ICACHE_RSP_ACK        ;//[nb_entity][icache_dedicated_nb_port]
41  public : sc_out<morpheo::Ticache_context_t    >  *** ICACHE_RSP_CONTEXT_ID ;//[nb_entity][icache_dedicated_nb_port]
42  public : sc_out<morpheo::Ticache_packet_t     >  *** ICACHE_RSP_PACKET_ID  ;//[nb_entity][icache_dedicated_nb_port]
43  public : sc_out<morpheo::Ticache_instruction_t> **** ICACHE_RSP_INSTRUCTION;//[nb_entity][icache_dedicated_nb_port][iaccess_nb_instruction]
44  public : sc_out<morpheo::Ticache_error_t      >  *** ICACHE_RSP_ERROR      ;//[nb_entity][icache_dedicated_nb_port]
45
46  public : sc_in <morpheo::Tcontrol_t           >  *** DCACHE_REQ_VAL        ;//[nb_entity][dcache_dedicated_nb_port]
47  public : sc_out<morpheo::Tcontrol_t           >  *** DCACHE_REQ_ACK        ;//[nb_entity][dcache_dedicated_nb_port]
48  public : sc_in <morpheo::Tdcache_context_t    >  *** DCACHE_REQ_CONTEXT_ID ;//[nb_entity][dcache_dedicated_nb_port]
49  public : sc_in <morpheo::Tdcache_packet_t     >  *** DCACHE_REQ_PACKET_ID  ;//[nb_entity][dcache_dedicated_nb_port]
50  public : sc_in <morpheo::Tdcache_address_t    >  *** DCACHE_REQ_ADDRESS    ;//[nb_entity][dcache_dedicated_nb_port]
51  public : sc_in <morpheo::Tdcache_type_t       >  *** DCACHE_REQ_TYPE       ;//[nb_entity][dcache_dedicated_nb_port]
52  public : sc_in <morpheo::Tdcache_data_t       >  *** DCACHE_REQ_WDATA      ;//[nb_entity][dcache_dedicated_nb_port]
53
54  public : sc_out<morpheo::Tcontrol_t           >  *** DCACHE_RSP_VAL        ;//[nb_entity][dcache_dedicated_nb_port]
55  public : sc_in <morpheo::Tcontrol_t           >  *** DCACHE_RSP_ACK        ;//[nb_entity][dcache_dedicated_nb_port]
56  public : sc_out<morpheo::Tdcache_context_t    >  *** DCACHE_RSP_CONTEXT_ID ;//[nb_entity][dcache_dedicated_nb_port]
57  public : sc_out<morpheo::Tdcache_packet_t     >  *** DCACHE_RSP_PACKET_ID  ;//[nb_entity][dcache_dedicated_nb_port]
58  public : sc_out<morpheo::Tdcache_data_t       >  *** DCACHE_RSP_RDATA      ;//[nb_entity][dcache_dedicated_nb_port]
59  public : sc_out<morpheo::Tdcache_error_t      >  *** DCACHE_RSP_ERROR      ;//[nb_entity][dcache_dedicated_nb_port]
60
61    // ===== [ Internal ]====================================================
62  public : morpheo::Tcontrol_t                      ** icache_req_ack        ;
63  public : morpheo::Tcontrol_t                      ** icache_rsp_val        ;
64  public : morpheo::Tcontrol_t                      ** dcache_req_ack        ;
65  public : morpheo::Tcontrol_t                      ** dcache_rsp_val        ;
66
67    // ===== [ Variables ]===================================================
68  private  : const sc_module_name name;
69  private  : Parameters         * param;
70
71  private  : char              ** read_iram;
72  private  : char              ** read_dram;
73  private  : char               * write_dram;
74
75  private  : bool               * context_stop;    // to determine which context have send the signal stop (a same thread can send many signal)
76  private  : uint32_t             nb_context_stop; // stop the simulation when all context have send the stop signal
77
78
79    // ===== [ Components ]==================================================
80  private  : cache  ::Cache                * component_cache;
81  private  : tty    ::TTY                 ** component_tty;
82  private  : ramlock::RamLock             ** component_ramlock;
83  private  : sim2os ::Sim2OS               * component_sim2os;
84  private  : data   ::Data                 * component_data;
85  private  : queue  ::Sort_Queue<irsp_t*> ** component_buffer_irsp;
86  private  : queue  ::Sort_Queue<drsp_t*> ** component_buffer_drsp;
87
88    // ===== [ Methods ]=====================================================
89
90    SC_HAS_PROCESS (Environment);
91   
92  public   :  Environment (sc_module_name name, Parameters * param);
93  public   : ~Environment (void);
94
95  public   : bool   init           (std::string section, const char * filename, const char ** list_section);
96  public   : void   reset          (void);
97  public   : void   stop           (uint32_t num_context);
98  public   : bool   simulation_end (void);
99
100  public   : void   transition     (void);
101  public   : void   genMoore       (void);
102
103  public   : friend std::ostream& operator<< (std::ostream& output, Environment &x);
104
105   
106  private  : 
107    template <class T>
108    void itoa  (T src, char *& dest, uint32_t size)
109    {
110      _cout(ENVIRONMENT,"<itoa> : size : %d, ",size);
111      __cout(ENVIRONMENT,"src : %.8x ",static_cast<uint32_t>(src));
112      __cout(ENVIRONMENT,"dest : ");
113
114      for (uint32_t i=0; i<size; i++)
115        {
116          uint32_t j = i;
117          dest [j] = (src & 0xFF);
118          src >>= 8; // shift byte
119
120          __cout(ENVIRONMENT,"%.2x",0xff&static_cast<uint32_t>(dest [j]));
121
122        }
123      __cout(ENVIRONMENT,".\n");
124    }
125   
126  private  : 
127    template <class T>
128    void atoi (char * src, T& dest, uint32_t size)
129    {
130      dest = 0;
131     
132      _cout(ENVIRONMENT,"<atoi> : size : %d, ",size);
133      __cout(ENVIRONMENT,"src : ");
134
135      for (uint32_t i=0; i<size; i++)
136        {
137          uint32_t j=(size)-(i)-1;
138          dest <<= 8; // shift byte
139          dest |= (static_cast<T>(src [j]) & 0xFF);
140
141          __cout(ENVIRONMENT,"%.2x",0xff&static_cast<uint32_t>(src [j]));
142        }
143      __cout(ENVIRONMENT," dest : %.8x\n",static_cast<uint32_t>(dest));
144    }
145  };
146};
147
148#endif
Note: See TracBrowser for help on using the repository browser.