-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
104 lines (86 loc) · 2.7 KB
/
Copy pathmain.cpp
File metadata and controls
104 lines (86 loc) · 2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/******************************************************
* This is the main file for the mips1 ArchC model *
* This file is automatically generated by ArchC *
* WITHOUT WARRANTY OF ANY KIND, either express *
* or implied. *
* For more information on ArchC, please visit: *
* http://www.archc.org *
* *
* The ArchC Team *
* Computer Systems Laboratory (LSC) *
* IC-UNICAMP *
* http://www.lsc.ic.unicamp.br *
******************************************************/
const char *project_name="mips";
const char *project_file="mips1.ac";
const char *archc_version="2.0beta1";
const char *archc_options="-abi -dy ";
#include <systemc.h>
#include "mips/mips.H"
#include "mmu/mmu.h"
#include "memory/memory.h"
#include "bus/bus.h"
#include "irqmp/irqmp.h"
#include "gptimer/gptimer.h"
#include "apbuart/apbuart.h"
using grlib::irqmp;
using grlib::gptimer;
using grlib::apbuart;
int sc_main(int ac, char *av[])
{
// Clock
sc_clock p_clock("p_clock", 4, SC_NS);
//! ISA simulator
cout << "Creating Processor" << endl;
mips mips_proc1("mips");
//! MMU
cout << "Creating mmu" << endl;
ac_tlm_mmu mmu("mmu");
//! Bus
cout << "Creating Bus routing system" << endl;
ac_tlm_bus bus("bus");
//! Memory
cout << "Creating Memory" << endl;
ac_tlm_mem mem("mem");
//! Interrupt Control Unit
cout << "Creating Interrupt Controller" << endl;
irqmp irq("irq");
//! GPtimer Frequency 40Hz
cout << "Creating Timer" << endl;
gptimer timer("timer",40);
//! UART serial Unit
cout << "Creating UART Serial Unit" << endl;
apbuart uart("uart");
#ifdef AC_DEBUG
ac_trace("mips1_proc1.trace");
#endif
// CPU interrupt port
irq.CPU_port[0](mips_proc1.intp);
// Clock connections with Peripherals
timer.clk(p_clock);
irq.clk(p_clock);
// Peripherals connected to Interrupt Controller by ports
timer.IRQ_port(irq.target_export);
uart.IRQ_port(irq.target_export);
mips_proc1.DM(mmu.target_export);
mips_proc1.ack_port(irq.target_export);
mmu.BUS_port(bus.target_export);
bus.MEM_port(mem.target_export);
bus.IRQ_port(irq.target_export);
bus.GPTIMER_port(timer.target_export);
bus.UART_port(uart.target_export);
mips_proc1.init(ac, av);
mips_proc1.set_prog_args();
cerr << endl;
sc_start();
mips_proc1.PrintStat();
cerr << endl;
#ifdef AC_STATS
mips1_proc1.ac_sim_stats.time = sc_simulation_time();
mips1_proc1.ac_sim_stats.print();
#endif
#ifdef AC_DEBUG
ac_close_trace();
#endif
return mips_proc1.ac_exit_status;
}