text
stringlengths 0
252
|
---|
0b11110000000000000000, //nop |
0b11110000000000000000, //nop |
0b11110000000000000000, //nop |
0b11110000000000000000, //nop |
0b11110000000000000000, //nop |
0b11110000000000000000 //nop |
}; |
SC_CTOR (IR){ |
SC_METHOD (process); |
sensitive << addr; |
for(int i=0; i<instNum; i++){ |
mem[i] = instruction[i]; |
} |
// filling out other rows with a nop opcode |
for(int i=instNum; i<819; i++){ |
mem[i] = 0b11110000000000000000; |
} |
} |
void process () { |
if(addr.read() < 819){ |
inst.write(mem[addr.read()]); |
} |
else{ |
inst.write(0); |
} |
} |
}; |
/* |
* @ASCK |
*/ |
#include <systemc.h> |
SC_MODULE (Memory) { |
sc_in <bool> r_nw; |
sc_in <sc_uint<13>> addr; |
sc_in <sc_int<8>> data; |
sc_out <sc_int<8>> out; |
/* |
** module global variables |
*/ |
sc_int<8> mem[8192] = {0}; // 2^13 rows |
bool done = false; |
SC_CTOR (Memory){ |
SC_METHOD (process); |
sensitive << r_nw << addr << data; |
} |
void process () { |
if(done){ |
return; |
} |
if(addr.read() < 8192){ |
if(r_nw.read()){ |
out.write(mem[addr.read()]); |
} |
else{ |
mem[addr.read()] = data.read(); |
out.write(mem[addr.read()]); |
} |
} |
else{ |
out.write(0); |
} |
} |
}; |
/* |
* @ASCK |
*/ |
#include <systemc.h> |
#include <./PC.cpp> |
#include <./IR.cpp> |
#include <./IF.cpp> |
#include <./Mux3.cpp> |
#include <./Mux8.cpp> |
#include <./RegFile.cpp> |
#include <./Controller.cpp> |
#include <./ID.cpp> |
#include <./ALU.cpp> |
#include <./EXE.cpp> |
#include <./WB.cpp> |
#include <bitset> |