-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
46 lines (36 loc) · 1.05 KB
/
main.cpp
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
#include "systemc.h"
#include "matrix_mult.h"
int sc_main( int argc, char *argv[] ) {
// Signals
sc_signal< sc_int<16> > sg1[16];
sc_signal< sc_int<16> > sg2[16];
sc_signal< sc_int<16> > sg3[16];
// Module
matrix_mult multiplier("Multiplier");
int z;
for (z=0; z<16; z++) {
multiplier.A[z](sg1[z]);
multiplier.B[z](sg2[z]);
multiplier.C[z](sg3[z]);
}
// Start of the Simulation
sc_start(1,SC_NS);
for(z=0; z<16; z++) {
sg1[z] = rand()%4;
sg2[z] = rand()%4;
}
sc_start(2, SC_NS);
std::cout << "primeira matrix" << '\n';
for(z=0; z<16; z = z+4) {
std::cout << " " << sg1[z] << ", " << sg1[z+1] << " ," << sg1[z+2] << " ," << sg1[z+3] <<'\n';
}
std::cout << "segunda matrix" << '\n';
for(z=0; z<16; z = z+4) {
std::cout << " " << sg2[z] << " ," << sg2[z+1] << " ," << sg2[z+2] << " ," << sg2[z+3] << '\n';
}
std::cout << "resultado" << '\n';
for(z=0; z<16; z = z+4) {
std::cout << " " << sg3[z] << " ," << sg3[z+1] << " ," << sg3[z+2] << " ," << sg3[z+3] << '\n';
}
return 0;
};