text
stringlengths 0
252
|
---|
i_SUB = 0x3,
|
i_ADDi = 0x8,
|
i_SHIFT = 0x9,
|
i_AND = 0x4,
|
i_OR = 0x5,
|
i_NOT = 0xA,
|
i_XOR = 0x6,
|
i_SLT = 0x7,
|
i_LW = 0,
|
i_SW = 0x1,
|
i_LUI = 0xB,
|
i_BEQ = 0xC,
|
i_BLT = 0xD,
|
i_J = 0xE,
|
i_JAL = 0xF
|
};
|
/*
|
* Execucao de uma funcao.
|
* - Acessa: breg, mem e contexto.
|
* - Saida: breg, mem ou pc.
|
*/
|
SC_MODULE(execute){
|
// Ponteiro para o contexto
|
Contexto_t *c_execute;
|
// Entradas
|
sc_fifo_in <Contexto_t*> execute_in;
|
// Saidas
|
sc_fifo_out <Contexto_t*> execute_out;
|
// Memoria
|
sc_port<mem_if> p_mem_ex;
|
// BREG
|
sc_port<breg_if> p_breg_ex;
|
// Funcao para impressao do decode
|
void debug_decode();
|
// Definicao do funcionamento do execute
|
void executing();
|
SC_CTOR(execute){
|
SC_THREAD(executing);
|
}
|
};
|
#include "fetch.h"
|
// Definicao do funcionamento do fetch
|
void fetch::fetching(){
|
while(true){
|
// Pega o ponteiro do contexto
|
c_fetch = fetch_in.read();
|
//// Pega a instrucao e incrementa o PC
|
//ri = mem[pc];
|
c_fetch->ri = p_mem_fetch->read_mem(c_fetch->pc);
|
//pc++;
|
c_fetch->pc++;
|
// Se nao possui mais instrucoes
|
if(c_fetch->ri == 0){
|
cout << "Nao possui mais instrucoes!" << endl;
|
sc_stop();
|
exit(0);
|
}
|
// Passa o ponteiro do contexto para o decode
|
fetch_out.write(c_fetch);
|
}
|
}
|
#include <systemc.h>
|
#include "contexto.h"
|
#include "mem.h"
|
#include "breg.h"
|
/*
|
* Decodificacao de uma funcao.
|
* - Acessa: mem e contexto.
|
* - Saida: ri e pc.
|
*/
|
SC_MODULE(fetch){
|
// Contexto
|
Contexto_t *c_fetch;
|
// Entradas
|
sc_fifo_in <Contexto_t*> fetch_in;
|
// Saidas
|
sc_fifo_out <Contexto_t*> fetch_out;
|
// Memoria
|
sc_port<mem_if> p_mem_fetch;
|
// Definicao do funcionamento do fetch
|
void fetching();
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.