text
stringlengths 0
252
|
---|
#include <systemc.h> |
SC_MODULE (RegFile) { |
sc_in_clk clk; |
sc_in <bool> regWrite; |
sc_in <sc_uint<3>> r1; |
sc_in <sc_uint<3>> r2; |
sc_in <sc_uint<3>> r3; |
sc_in <sc_int<8>> data; |
sc_out <sc_int<8>> Rr1; |
sc_out <sc_int<8>> Rr2; |
//testing wires |
sc_out <sc_int<8>> r[8]; |
/* |
** module global variables |
*/ |
sc_int<8> reg[8]; // 8 registers in register file |
int c = 0; |
SC_CTOR (RegFile){ |
SC_METHOD (process); |
sensitive << regWrite << r1 << r2 << r3 << data; |
} |
void process () { |
// whether the regWrite is 0 or not, the Rr1 and Rr2 have the corresponding output! |
Rr1.write(reg[r1.read()]); |
Rr2.write(reg[r2.read()]); |
if(regWrite.read() == 1){ |
reg[r3.read()] = data.read(); |
} |
for (int i=0; i< 8; i++){ |
r[i].write(reg[i]); |
} |
if (c++ == 32) { |
reg[0] = 3; |
} |
} |
}; |
/* |
* @ASCK |
*/ |
#include <systemc.h> |
/* |
** GLOBAL EVENT FOR MICRO-ACC |
*/ |
////////////////////////// |
sc_event micro_acc_ev;/// |
//////////////////////// |
/* |
** GLOBAL EVENT FOR ACC-MEMORY -> READ MODE |
*/ |
////////////////////////// |
sc_event acc_mem_read_ev;/// |
//////////////////////// |
/* |
** GLOBAL EVENT FOR ACC-MEMORY -> WRITE MODE |
*/ |
////////////////////////// |
sc_event acc_mem_write_ev;/// |
//////////////////////// |
/* |
** variable for checking if IF/ID/EXE/WB should have been stopped after call=1 on memory-access stage or not! |
*/ |
bool now_is_call = false; |
#include <./Micro.cpp> |
#include <./Bus.cpp> |
#include <./Memory.cpp> |
#include <./Acc.cpp> |
SC_MODULE(System) |
{ |
sc_in_clk clk; |
sc_in_clk clk_bus; |
// testing wires |
sc_out<sc_uint<14>> pc; |
sc_out<sc_uint<5>> test_aluop; |
sc_out<sc_int<8>> reg_dump[8]; |
/* |
Subsets and Splits