1
0
mirror of https://github.com/livingcomputermuseum/UniBone.git synced 2026-01-28 20:51:08 +00:00

Connected CPU20 to INTR,INIT,Power ON/OFF.

PRU INTR routing still do to.
This commit is contained in:
Joerg Hoppe
2019-08-25 09:17:28 +02:00
parent f938c8ba8a
commit ea91180f28
9 changed files with 137 additions and 59 deletions

View File

@@ -84,33 +84,6 @@ bool cpu_c::on_param_changed(parameter_c *param) {
return device_c::on_param_changed(param); // more actions (for enable)
}
extern "C" {
// functions to be used by Angelos CPU emulator
// Result: 1 = OK, 0 = bus timeout
int cpu_dato(unsigned addr, unsigned data) {
uint16_t wordbuffer = (uint16_t) data;
unibusadapter->cpu_DATA_transfer(the_cpu->data_transfer_request, UNIBUS_CONTROL_DATO, addr, &wordbuffer);
return the_cpu->data_transfer_request.success ;
}
int cpu_datob(unsigned addr, unsigned data) {
uint16_t wordbuffer = (uint16_t) data;
// TODO DATOB als 1 byte-DMA !
unibusadapter->cpu_DATA_transfer(the_cpu->data_transfer_request, UNIBUS_CONTROL_DATOB, addr, &wordbuffer);
return the_cpu->data_transfer_request.success ;
}
int cpu_dati(unsigned addr, unsigned *data) {
uint16_t wordbuffer;
unibusadapter->cpu_DATA_transfer(the_cpu->data_transfer_request, UNIBUS_CONTROL_DATI, addr, &wordbuffer);
*data = wordbuffer;
// printf("DATI; ba=%o, data=%o\n", addr, *data) ;
return the_cpu->data_transfer_request.success ;
}
}
// background worker.
void cpu_c::worker(unsigned instance) {
UNUSED(instance); // only one
@@ -128,27 +101,27 @@ void cpu_c::worker(unsigned instance) {
if (runmode.value != (ka11.state != 0))
ka11.state = runmode.value;
condstep(&ka11);
ka11_condstep(&ka11);
if (runmode.value != (ka11.state != 0))
runmode.value = ka11.state != 0;
if (init.value) {
// user wants CPU reset
reset(&ka11);
ka11_reset(&ka11);
init.value = 0;
}
#if 0
if (runmode.value) {
// simulate a fetch
nxm = !cpu_dati(pc, &opcode);
nxm = !unibone_dati(pc, &opcode);
if (nxm) {
printf("Bus timeout at PC = %06o. HALT.\n", pc);
runmode.value = false;
}
pc = (pc + 2) % 0100; // loop around
// set LEDS
nxm = !cpu_dato(dr, pc & 0xf);
nxm = !unibone_dato(dr, pc & 0xf);
if (nxm) {
printf("Bus timeout at DR = %06o. HALT.\n", dr);
runmode.value = false;
@@ -173,17 +146,76 @@ void cpu_c::on_after_register_access(unibusdevice_register_t *device_reg,
UNUSED(unibus_control);
}
// TODO
void cpu_c::on_power_changed(void) {
if (power_down) { // power-on defaults
INFO("CPU: ACLO failed");
ka11_pwrdown(&the_cpu->ka11);
// ACLO failed.
// CPU traps to vector 24 and has 2ms time to execute code
} else {
INFO("CPU: DCLO restored");
ka11_pwrup(&the_cpu->ka11);
// DCLO restored
// CPU loads PC and PSW from vector 24
}
}
// UNIBUS INIT: clear all registers
void cpu_c::on_init_changed(void) {
// write all registers to "reset-values"
if (init_asserted) {
reset_unibus_registers();
INFO("cpu::on_init()");
}
// a CPU does not react to INIT ... else its own RESET would reset it.
}
// TODO
// CPU received interrupt vector from UNIBUS
void cpu_c::on_interrupt(uint16_t vector) {
// CPU sequence:
// push PSW to stack
// push PC to stack
// PC := *vector
// PSW := *(vector+2)
ka11_setintr(&the_cpu->ka11, vector);
}
extern "C" {
// functions to be used by Angelos CPU emulator
// Result: 1 = OK, 0 = bus timeout
int unibone_dato(unsigned addr, unsigned data) {
uint16_t wordbuffer = (uint16_t) data;
unibusadapter->cpu_DATA_transfer(the_cpu->data_transfer_request, UNIBUS_CONTROL_DATO, addr,
&wordbuffer);
return the_cpu->data_transfer_request.success;
}
int unibone_datob(unsigned addr, unsigned data) {
uint16_t wordbuffer = (uint16_t) data;
// TODO DATOB als 1 byte-DMA !
unibusadapter->cpu_DATA_transfer(the_cpu->data_transfer_request, UNIBUS_CONTROL_DATOB, addr,
&wordbuffer);
return the_cpu->data_transfer_request.success;
}
int unibone_dati(unsigned addr, unsigned *data) {
uint16_t wordbuffer;
unibusadapter->cpu_DATA_transfer(the_cpu->data_transfer_request, UNIBUS_CONTROL_DATI, addr,
&wordbuffer);
*data = wordbuffer;
// printf("DATI; ba=%o, data=%o\n", addr, *data) ;
return the_cpu->data_transfer_request.success;
}
// CPU has changed the arbitration level, just forward
void unibone_prioritylevelchange(uint8_t level) {
mailbox->arbitrator.cpu_priority_level = level;
}
// TODO
// CPU executes RESET opcode -> pulses INIT line
void unibone_bus_init(unsigned pulsewidth_ms) {
unibus->init(pulsewidth_ms);
}
}