31 #include <Simulator.h> 39 #include <TDmaNetif.h> 40 #include <TNetBridge.h> 63 std::cout << std::endl <<
"Simulation interrupted. Wait for the current epoch to finish or press CTRL+C again to force quit." << std::endl;
69 std::cout << std::endl <<
"Hold your horses!" << std::endl;
75 void connect_routers(HermesRouter* r1, uint32_t p1, HermesRouter* r2, uint32_t p2){
77 r1->SetOutputBuffer(r2->GetInputBuffer(p2), p1);
78 r2->SetOutputBuffer(r1->GetInputBuffer(p1), p2);
83 std::cout << r1->GetInputBuffer(p1)->GetName()
84 <<
" <---> " << r2->GetInputBuffer(p2)->GetName() << std::endl;
87 int main(
int __attribute__((unused)) argc,
char** argv){
91 std::cout <<
"usage: \n\t" << argv[0] <<
" <software-image>" << std::endl;
95 std::string param1 = std::string(argv[1]);
100 std::cout <<
"URSA/ORCA Platform " << std::endl;
101 std::cout <<
"==============[ TILE IDENTIFICATION ]" << std::endl;
104 for(
int x = 0; x < ORCA_NOC_WIDTH; x++){
105 for(
int y = 0; y < ORCA_NOC_HEIGHT; y++){
111 std::cout << std::endl;
114 #ifdef ORCA_ENABLE_GDBRSP 115 std::cout <<
"==============[ GDBRSP SERVERS ]" << std::endl;
120 for(
int x = 0; x < ORCA_NOC_WIDTH; x++){
121 for(
int y = 0; y < ORCA_NOC_HEIGHT; y++){
125 std::cout <<
"[----]";
131 std::cout << std::endl;
134 std::cout <<
"==============[ ROUTER CONNECTIONS ]" << std::endl;
137 for(
int x = 0; x < ORCA_NOC_WIDTH - 1; x++)
138 for(
int y = 0; y < ORCA_NOC_HEIGHT; y++)
142 for(
int x = 0; x < ORCA_NOC_WIDTH; x++)
143 for(
int y = 0; y < ORCA_NOC_HEIGHT - 1; y++)
147 for(
int x = 0; x < ORCA_NOC_WIDTH; x++){
148 for(
int y = 0; y < ORCA_NOC_HEIGHT; y++){
151 if(x == 0 && y == 0)
continue;
158 std::cout <<
"==============[ SIMULATION ]" << std::endl;
161 Simulator* s =
new Simulator();
163 std::cout <<
"Scheduling..." << std::endl;
166 for(
int x = 0; x < ORCA_NOC_WIDTH; x++){
167 for(
int y = 0; y < ORCA_NOC_HEIGHT; y++){
170 if(x == 0 && y == 0){
171 s->Schedule(Event(1, ((
NetworkTile*)tiles[x][y])->GetSocket()));
177 s->Schedule(Event(1, ((
ProcessingTile*)tiles[x][y])->GetDmaNetif()));
181 s->Schedule(Event(1, tiles[x][y]->GetRouter()));
187 std::cout <<
"Please wait..." << std::endl;
191 std::chrono::high_resolution_clock::time_point t1, t2;
195 t1 = std::chrono::high_resolution_clock::now();
197 t2 = std::chrono::high_resolution_clock::now();
199 auto duration = std::chrono::duration_cast<std::chrono::milliseconds>( t2 - t1 ).count();
203 double hertz = ((double)
ORCA_EPOCH_LENGTH) / ((double)((
double)duration / 1000.0));
206 std::cout <<
"notice: epoch #" << s->GetEpochs() <<
" took ~" 207 << duration <<
"ms (running @ " << (hertz / 1000000.0)
208 <<
" MHz)" << std::endl;
210 #ifdef ORCA_EPOCHS_TO_SIM 217 }
catch(std::runtime_error& e){
218 std::cout << e.what() << std::endl;
223 std::cout <<
"==============[ BUFFERS' STATUSES ]" << std::endl;
224 for(
int x = 0; x < ORCA_NOC_WIDTH; x++){
225 for(
int y = 0; y < ORCA_NOC_HEIGHT; y++){
227 HermesRouter* r = tiles[x][y]->
GetRouter();
228 std::cout << r->GetName() <<
":" 229 <<
" S=" << r->GetInputBuffer(
SOUTH)->size()
230 <<
" N=" << r->GetInputBuffer(
NORTH)->size()
231 <<
" W=" << r->GetInputBuffer(
WEST)->size()
232 <<
" E=" << r->GetInputBuffer(
EAST)->size()
233 <<
" L=" << r->GetInputBuffer(
LOCAL)->size()
234 <<
" RR=" << r->GetRR()
240 std::cout <<
"==============[ NIs STATUSES ]" << std::endl;
241 for(
int x = 0; x < ORCA_NOC_WIDTH; x++){
242 for(
int y = 0; y < ORCA_NOC_HEIGHT; y++){
244 if(x == 0 && y == 0)
continue;
247 std::cout << n->GetName() <<
":" 248 <<
" SEND_STATE=" <<
static_cast<unsigned int>(n->GetSendState())
249 <<
" RECV_STATE=" << static_cast<unsigned int>(n->GetRecvState())
256 std::cout <<
"==============[ CPU STATUSES ]" << std::endl;
257 for(
int x = 0; x < ORCA_NOC_WIDTH; x++){
258 for(
int y = 0; y < ORCA_NOC_HEIGHT; y++){
267 <<
": INTR=" << (int)(n->GetSignalIntr()->Read())
268 <<
", STALL=" << (
int)(n->GetSignalStall()->Read()) << std::endl;
278 for(
int x = 0; x < ORCA_NOC_WIDTH; x++){
279 for(
int y = 0; y < ORCA_NOC_HEIGHT; y++){
291 std::cout <<
"Simulation failed!" << std::endl;
293 std::cout <<
"Simulation ended without errors." << std::endl;
Tile * tiles[ORCA_NOC_WIDTH][ORCA_NOC_HEIGHT]
Implementation file for ORCA-SIM program.
#define MEM0_SIZE
This file is part of project URSA.
void connect_routers(HermesRouter *r1, uint32_t p1, HermesRouter *r2, uint32_t p2)
#define ORCA_EPOCHS_TO_SIM
#define ORCA_EPOCH_LENGTH
static volatile sig_atomic_t interruption
This file is part of project URSA.
int main(int __attribute__((unused)) argc, char **argv)
HermesRouter * GetRouter()
Get current router of the PE.
static void sig_handler(int _)
This class models an entire processing element that contains RAM memory (3x), DMA, NoC Router, HFRiscV core.