Name jride_isa; Assembly 0004; Revision P1 1.0; PartNo U1 ATF1508AS; Device f1508ispplcc84; Company Retrotronics.org; Designer Alan H.; Location None; Date October 2011; property ATMEL { xor_synthesis=on }; property ATMEL { logic_doubling=on }; property ATMEL { jtag=on }; PROPERTY ATMEL { preassign keep }; PROPERTY ATMEL { TMS_pullup=on }; PROPERTY ATMEL { TDI_pullup=on }; /* * Pin assignments * * Make all data and address outputs fast slew and all chip selects slow */ Pin 1 = RESET; Pin 4 = !IDE_RESET; Pin 35 = A0; Pin 36 = A1; Pin 40 = A2; Pin 39 = A3; Pin 41 = A4; Pin 44 = A5; Pin 45 = A6; Pin 46 = A7; Pin 51 = A8; Pin 55 = A9; Pin 54 = A10; Pin 56 = A11; Pin 57 = A12; Pin 58 = A13; Pin 52 = A14; Pin 60 = A15; Pin 61 = A16; Pin 63 = A17; Pin 64 = A18; Pin 65 = A19; Pin 69 = D0; Pin 70 = D1; Pin 74 = D2; Pin 76 = D3; Pin 75 = D4; Pin 77 = D5; Pin 80 = D6; Pin 79 = D7; Pin 24 = IDE_D0; Pin 22 = IDE_D1; Pin 21 = IDE_D2; Pin 16 = IDE_D3; Pin 12 = IDE_D4; Pin 11 = IDE_D5; Pin 8 = IDE_D6; Pin 5 = IDE_D7; Pin 6 = IDE_D8; Pin 9 = IDE_D9; Pin 10 = IDE_D10; Pin 15 = IDE_D11; Pin 17 = IDE_D12; Pin 18 = IDE_D13; Pin 20 = IDE_D14; Pin 25 = IDE_D15; Pin 30 = IDE_A0; Pin 29 = IDE_A1; Pin 31 = IDE_A2; Pin 28 = !IDE_RD; Pin 27 = !IDE_WR; Pin 68 = !MEMWR; Pin 67 = !MEMRD; Pin 37 = !ROM_CE; Pin 2 = !DIP1; Pin 84 = !DIP2; Pin 83 = !DIP3; Pin 81 = CLK; Pin 73 = !ZWS; Pin 34 = !IDE_CE0; Pin 33 = !IDE_CE1; Pin 48 = ROM_A15; Pin 49 = ROM_A16; Pin 50 = ROM_A18; /* * Register field map for internal write only registers * accessed immedaitely after the IDE register window * used to control the ROM disk remap window address, * target page, and to allow independent reset of the * attached IDE disk. * * Select 0 Bit 0 reg0 ROM remap window A13 reference * 0 1 reg1 ROM remap window A14 reference * 0 2 reg2 ROM remap window A15 reference * 0 3 reg3 ROM remap window A16 reference * 0 4 ---- Reserved * 0 5 ---- Reserved * 0 6 reg4 Zero wait state enable * 0 7 reg5 IDE reset control (1 = reset) * * Select 1 Bit 0 reg6 ROM remap target page bit 0 (A13) * 1 1 reg7 ROM remap target page bit 1 (A14) * 1 2 reg8 ROM remap target page bit 2 (A15) * 1 3 reg9 ROM remap target page bit 3 (A16) * 1 4 reg10 ROM remap target page bit 4 (A17) * 1 5 reg11 ROM remap target page bit 5 (A18) * 1 6 reg12 ROM write protect (1 = read only) * 1 7 reg13 ROM remap window enable/disable */ Pinnode = [reg11..0]; /* Register mapping aliases */ IDE_RESET = reg4; ROM_A18 = reg10; ROM_A17 = reg9; ROM_A16 = reg8; ROM_A15 = reg7; ROM_A14 = reg6; ROM_A13 = reg5; MAP16 = reg3; MAP15 = reg2; MAP14 = reg1; MAP13 = reg0; MAPE = reg11; /* * 16KB option ROM decode window at 16KB steps between * C0000 & E0000 matched against DIP switches 1-3 */ Pinnode = OPTION_WIN; OPTION_WIN = A19 & A18 & !A17 & !(A16 $ DIP1) & !(A15 $ DIP2) & !(A14 $ DIP3); /* * Break down of the 16KB option ROM decode window. * 15KB of ROM space, a virtualize 512 byte IDE sector * access buffer, 16 IDE device registers, and two * internal registers with-in this space. The 494 * trailing addresses are unused. */ Pinnode = ROM_AREA; Pinnode = IDE_DATA; Pinnode = IDE_WIN; Pinnode = REG_CS0; Pinnode = REG_CS1; field SUBADDR = [A13..0]; ROM_AREA = OPTION_WIN & SUBADDR:[0000..3BFF]; IDE_DATA = OPTION_WIN & SUBADDR:[3C00..3DFF]; IDE_WIN = OPTION_WIN & SUBADDR:[3E00..3E0F]; REG_CS0 = OPTION_WIN & SUBADDR:[3E10..3E10]; REG_CS1 = OPTION_WIN & SUBADDR:[3E11..3E11]; NP_IDE_DATA = SUBADDR:[3C00..3DFF]; /* * 8KB flash disk remap window positioned at 8KB steps * between C0000 & E0000 matched against address in remap * register and remap enable control (bit 0) */ Pinnode = REMAP_WIN; REMAP_WIN = A19 & A18 & !A17 & !(A16 $ MAP16) & !(A15 $ MAP15) & !(A14 $ MAP14) & !(A13 $ MAP13) & MAPE; /* * At 10 MHz, 1 bus cycle is 100ns. As long as the * IDE register reponse and Flash/ROM parts can present * or sample data within that time from strobe assertion, * we can tell the CPU to not insert any additional waits. */ ZWS = 'b'0; /*OPTION_WIN & REMAP_WIN;*/ /* Flash/ROM chip select output signal */ ROM_CE = (MEMRD # MEMWR) & (ROM_AREA # REMAP_WIN); /* * Three ROM address lines are multiplexed with the * IDE address lines. For remap window access, they * carry the remap register values. For the IDE * sector window, they zero to IDE address 0 (data * register), and for all other IDE access they * pass through from A2..0. */ IDE_A0 = (REMAP_WIN & ROM_A13) # (IDE_WIN & A0); IDE_A1 = (REMAP_WIN & ROM_A17) # (IDE_WIN & A1); IDE_A2 = (REMAP_WIN & ROM_A14) # (IDE_WIN & A2); /* * The buffered strobes also route to the strobe inputs * on the Flash/ROM parts. If we have an Atmel EEPROM * installed, we need extra protection against stray * writes from girls... I mean processes gone wild. */ IDE_RD = MEMRD; IDE_WR = MEMWR; /* * IDE strobe selection logic. These should be left * at slow slew while data and address lines fast to * (hopefully) prevent gate racing. I haven't yet * computed all the propagation times (by hand - FU Atmel) */ IDE_DATA_SEL = NP_IDE_DATA & ((!A0 & MEMRD) # (A0 & MEMWR)); IDE_CE0 = OPTION_WIN & (SUBADDR:[3E00..3E07] # IDE_DATA_SEL); IDE_CE1 = OPTION_WIN & SUBADDR:[3E08..3E0F]; /* Internal register loads */ reg11.d = D7; reg10.d = D5; reg9.d = D4; reg8.d = D3; reg7.d = D2; reg6.d = D1; reg5.d = D0; [reg11..5].ar = RESET; [reg11..5].ck = MEMWR & REG_CS1; reg4.d = D7; reg3.d = D3; reg2.d = D2; reg1.d = D1; reg0.d = D0; [reg4..0].ar = RESET; [reg4..0].ck = MEMWR & REG_CS0; /* * Bus steering and latch logic for 16-bit IDE data window * reads and writes. A single 8-bit latch is used to for * both directions. You could use two latches here, one * for read and one for write, but so far synthesis has * shown no combinatorial logic savings. * A rep movsw is used to transfer a sector. The 8088/V20 * will break each 16-bit mov into two successive 8-bit * bus cycles. When transfering a sector in from the drive, * the CS is asserted on the even address location and the * upper IDE byte is caught by the latch and returned during * the odd cycle. When transfering a sector out to the drive, * the CS is asserted on the odd address location presenting * the IDE lower byte latched in during the even cycle and * the IDE upper byte from the odd cycle ISA bus value. * * The switch power savings that could be gained by limiting * latching to only the IDE sector window is not worth the * combinatorial logic expense. */ Pinnode = [DR7..0]; DR7.d = IDE_D15; DR6.d = IDE_D14; DR5.d = IDE_D13; DR4.d = IDE_D12; DR3.d = IDE_D11; DR2.d = IDE_D10; DR1.d = IDE_D9; DR0.d = IDE_D8; [DR7..0].ar = RESET; [DR7..0].ck = !MEMRD # !IDE_DATA # A0; Pinnode = [DW7..0]; DW7.d = D7; DW6.d = D6; DW5.d = D5; DW4.d = D4; DW3.d = D3; DW2.d = D2; DW1.d = D1; DW0.d = D0; [DW7..0].ar = RESET; [DW7..0].ck = MEMWR & IDE_DATA & !A0; /* * 16-bit steering logic is only ever invoked for the * virtual IDE sector window selected below. In such * cases, the ISA bus will be presenting the upper byte * and the lower byte will come from the latch value * loaded during the previous even address write cycle. * * For normal 8-bit writes, the lower byte of the * buffered bus is a straight pass-through of the ISA * bus data lines. */ IDE_D15 = D7; IDE_D14 = D6; IDE_D13 = D5; IDE_D12 = D4; IDE_D11 = D3; IDE_D10 = D2; IDE_D9 = D1; IDE_D8 = D0; IDE_D7 = (NP_IDE_DATA & DW7) # (!NP_IDE_DATA & D7); IDE_D6 = (NP_IDE_DATA & DW6) # (!NP_IDE_DATA & D6); IDE_D5 = (NP_IDE_DATA & DW5) # (!NP_IDE_DATA & D5); IDE_D4 = (NP_IDE_DATA & DW4) # (!NP_IDE_DATA & D4); IDE_D3 = (NP_IDE_DATA & DW3) # (!NP_IDE_DATA & D3); IDE_D2 = (NP_IDE_DATA & DW2) # (!NP_IDE_DATA & D2); IDE_D1 = (NP_IDE_DATA & DW1) # (!NP_IDE_DATA & D1); IDE_D0 = (NP_IDE_DATA & DW0) # (!NP_IDE_DATA & D0); [IDE_D15..0].oe = MEMWR; /* * In the ISA version, the ROM/Flash is on the buffered * data bus. Thus we need to enable data output for all * reads in both windows (option ROM and ROM remap). * * Bus steering is based on: * * - Sector window even read: IDE lower -> ISA (latches upper) * - Sector window odd read: Latched IDE upper -> ISA * - All other window reads: IDE lower -> ISA (pass-through) */ READ_LATCH = NP_IDE_DATA & A0; D0 = (READ_LATCH & DR0) # (!READ_LATCH & IDE_D0); D1 = (READ_LATCH & DR1) # (!READ_LATCH & IDE_D1); D2 = (READ_LATCH & DR2) # (!READ_LATCH & IDE_D2); D3 = (READ_LATCH & DR3) # (!READ_LATCH & IDE_D3); D4 = (READ_LATCH & DR4) # (!READ_LATCH & IDE_D4); D5 = (READ_LATCH & DR5) # (!READ_LATCH & IDE_D5); D6 = (READ_LATCH & DR6) # (!READ_LATCH & IDE_D6); D7 = (READ_LATCH & DR7) # (!READ_LATCH & IDE_D7); [D7..0].oe = MEMRD & (OPTION_WIN # REMAP_WIN);