Частина тексту файла (без зображень, графіків і формул):
Міністерство освіти і науки України
Національний університет «Львівська політехніка»
Кафедра ЕОМ
Звіт
до лабораторної роботи №6
з дисципліни: «Комп’ютерні системи»
на тему:
«Дослідження програмної моделі блоку PAGING
з моделі RISC CPU»
Львів – 2012
Тема роботи: Дослідження програмної моделі блоку PAGING з моделі RISC CPU.
Мета роботи: Дослідити програмну модель блоку PAGING, яка входить до складу програмної моделі RISC CPU, створеної на мові SystemC. Побудувати структурну схему блоку PAGING.
Програмна модель блоку Instruction Decode Unit (DECODE)
/***********************************************************************
paging.h -- Instruction Paging Unit
**********************************************************************/
/******************************************************************************
struct paging : sc_module {
sc_in<unsigned > paging_din; // input data
sc_in<bool> paging_csin; // chip select
sc_in<bool> paging_wein; // write enable
sc_in<unsigned > logical_address; // logical address
sc_in<unsigned > icache_din; // data from BIOS/icache
sc_in<bool> icache_validin; // data valid bit
sc_in<bool> icache_stall; // stall IFU if busy
sc_out<unsigned > paging_dout; // output data
sc_out<bool> paging_csout; // output cs to cache/BIOS
sc_out<bool> paging_weout; // write enable to cache/BIOS
sc_out<unsigned > physical_address; // physical address
sc_out<unsigned > dataout; // dataout from memory
sc_out<bool> data_valid; // data valid
sc_out<bool> stall_ifu; // stall IFU if busy
sc_in_clk CLK;
signed int pid_reg; //CPU process ID register
SC_CTOR(paging) {
SC_CTHREAD(entry, CLK.pos());
pid_reg = 0;
}
void entry();
};
/********************************************************************** paging.cpp -- Instruction Paging Unit
***********************************************************************/
/******************************************************************************
#include <iostream.h>
#include "systemc.h"
#include "paging.h"
#include "directive.h"
void paging::entry()
{
int address=0;
int address_conversion_factor = 0;
int dataout_tmp =0;
while (true) {
wait_until(paging_csin.delayed() == true);
address = logical_address.read();
address_conversion_factor = paging_din.read();
if (address >= 5) {
if (paging_wein.read() == true) { // Write operation
paging_dout.write(paging_din.read());
paging_csout.write(true);
paging_weout.write(true);
physical_address.write(logical_address.read());
wait();
paging_csout.write(false);
paging_weout.write(false);
}
else { // Read operation
paging_csout.write(true);
paging_weout.write(false);
physical_address.write(logical_address.read());
wait();
wait_until(icache_validin.delayed() == true);
dataout_tmp = icache_din.read();
if (PRINT_PU){
cout << "-----------------------" << endl;
printf( "PAGE : mem=%x\n",dataout_tmp);
cout << "PAGE : " ;
cout << " at CSIM " << sc_time_stamp() << endl;
cout << "-----------------------" << endl;
}
dataout.write(icache_din.read());
data_valid.write(true);
paging_csout.write(false);
wait();
data_valid.write(false);
wait();
}
}
}
} // end of entry function
Висновок: на даній лабораторній роботі дослідив програмну модель блоків PAGING яка входить до складу програмної моделі RISС CPU, створеної на мові SystemC. Побудував структурну схему блока PAGING.