1
0
mirror of https://github.com/livingcomputermuseum/UniBone.git synced 2026-04-14 07:49:47 +00:00

Fast GRANT forwarding, fixes "hang" on 11/84

This commit is contained in:
Joerg Hoppe
2019-12-11 08:08:22 +01:00
parent 130c1f4086
commit 061dbac5b6

View File

@@ -120,8 +120,10 @@ void main(void) {
while (true) {
uint8_t arm2pru_req_cached;
uint8_t cpu_grant_mask; // GRANts generated by physical or emulated CPU
if (sm_data_master_state == NULL) {
// State 1 "SLAVE"
// DATA or INTR for CPU?
@@ -132,41 +134,43 @@ void main(void) {
while ((sm_data_slave_state = sm_data_slave_state())
&& EVENT_IS_ACKED(mailbox, deviceregister))
// throws signals to ARM,
// Acess to internal registers may may issue AMR2PRU opcode, so exit loop then
// Acess to internal registers may issue AMR2PRU opcode, so exit loop then
;// execute complete slave cycle, then check NPR/INTR
// signal INT or PWR FAIL to ARM
// before arb_worker(), so BR/NPR requests are canceled on INIT
do_event_initializationsignals();
if (!emulate_cpu) {
// Fast forward device requests GRANTed by physical CPU.
// (On 11/84 possible SACK timeout when blocked by device register event?)
// Only one GRANT at a time may be active, else arbitrator malfunction.
// Arbitrator asserts SACK is inactive
// latch[0]: BG signals are inverted, "get" is non-inverting: bit = active signal.
// "set" is inverting!
cpu_grant_mask = buslatches_getbyte(0) & PRIORITY_ARBITRATION_BIT_MASK; // read GRANT IN
// forward un-requested GRANT IN to GRANT OUT for other cards on neighbor slots
sm_arb.device_forwarded_grant_mask = cpu_grant_mask
& ~sm_arb.device_request_signalled_mask;
buslatches_setbits(0, PRIORITY_ARBITRATION_BIT_MASK, ~sm_arb.device_forwarded_grant_mask)
;
// "A device may not accept a grant (assert SACK) after it passes the grant"
}
// Priority Arbitration
// Delay INTR or DMA while BUS halted via SSYN.
// ARM may start DMA within deviceregister event!
if (EVENT_IS_ACKED(mailbox, deviceregister)) {
// execute one of the arbitration workers
uint8_t cpu_grant_mask;
if (emulate_cpu) {
// handle GRANT/SACK/BBSY for emulated devices
cpu_grant_mask = sm_arb_worker_cpu(); // GRANT device requests
// do not read GRANT signals from UNIBUS, BG/NPGOUT not visible for
// emulated devices
// sm_arb.device_forwarded_grant_mask = 0 ;
} else {
// device requests GRANTed by physical CPU
} // else GRANTEd by physical CPU, see above
// Only one at a time may be active, else arbitrator malfucntion.
// Arbitrator asserts SACK is inactive
// latch[0]: BG signals are inverted, "get" is non-inverting: bit = active signal.
// "set" is inverting!
cpu_grant_mask = buslatches_getbyte(0) & PRIORITY_ARBITRATION_BIT_MASK; // read GRANT IN
// forward un-requested GRANT IN to GRANT OUT for other cards on neighbor slots
sm_arb.device_forwarded_grant_mask = cpu_grant_mask
& ~sm_arb.device_request_signalled_mask;
buslatches_setbits(0, PRIORITY_ARBITRATION_BIT_MASK, ~sm_arb.device_forwarded_grant_mask)
;
// "A device may not accept a grant (assert SACK) after it passes the grant"
}
// handle GRANT/SACK/BBSY for emulated devices
uint8_t granted_request = sm_device_arb_worker(cpu_grant_mask); // devices process GRANT
// sm_device_arb_worker()s include State 2 "BBSYWAIT".
// So now SACK maybe set, even if grant_mask is still 0
@@ -235,6 +239,7 @@ void main(void) {
if (mailbox.dma.cpu_access) {
// Emulated CPU: no NPR/NPG/SACK protocol
sm_arb.cpu_request = 1;
//PRU_DEBUG_PIN0_PULSE(50) ; // CPU20 performace
} else {
// Emulated device: raise request for emulated or physical Arbitrator.
sm_arb.device_request_mask |= PRIORITY_ARBITRATION_BIT_NP;
@@ -294,7 +299,7 @@ void main(void) {
// bool flag much faster to access than shared mailbox member.
if (emulate_cpu != mailbox.cpu_enable) {
emulate_cpu = mailbox.cpu_enable;
sm_arb_reset() ; // new arbitration algorithms
sm_arb_reset(); // new arbitration algorithms
}
mailbox.arm2pru_req = ARM2PRU_NONE; // ACK: done
break;