Zilog Z80: Difference between revisions

From Fox Labs Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(19 intermediate revisions by the same user not shown)
Line 2: Line 2:
|name          = Zilog Z80
|name          = Zilog Z80
|produced-start = March 1976
|produced-start = March 1976
|slowest        = 2.5, 4, 6, 8
|slowest        = 2.5
|slow-unit      = MHz
|slow-unit      = MHz
|fastest        = 10
|fastest        = 20
|fast-unit      = MHz with CMOS variant up to 20 MHz and binary compatible derivatives (from Zilog) up to 33 and 50 MHz
|fast-unit      = MHz
|manuf1        = [[Mostek]], [[Synertek]], [[Zilog]], [[SGS-Thomson]], [[NEC]], [[Sharp Corporation|Sharp]], [[Toshiba]], [[Rohm]], [[GoldStar]] ([[LG]]), [[Hitachi]], [[National Semiconductor]] and others
|manuf1        = [[Zilog]], [[Mostek]], [[Synertek]], [[SGS-Thomson]], [[NEC]], [[Sharp Corporation|Sharp]], [[Toshiba]], [[Rohm]], [[GoldStar]] ([[LG]]), [[Hitachi]], [[National Semiconductor]] and others
|designfirm    = Federico Faggin, Masatoshi Shima
|arch          = [[Zilog Z80 instruction set|Z80]]
|arch          = Z80{{efn-lr|Which is backwards compatible with Intel 8080}}
|data-width    = 8 bits
|data-width    = 8 bits
|address-width  = 16 bits
|address-width  = 16 bits
|sock1          = Not applicable
|sock1          = Not applicable
|pack1          = 40-pin [[Dual in-line package|DIP]], 44-pin [[Plastic leaded chip carrier|PLCC]], 44-pin [[QFP]]
|pack1          = 40-pin [[Dual in-line package|DIP]], 44-pin [[Plastic leaded chip carrier|PLCC]], 44-pin [[QFP]]
|transistors    = 8500 (4 μm process)
|predecessor  = {{Plainlist|
*[[Intel 8080]]}}
|successor    = {{Plainlist|
|successor    = {{Plainlist|
*[[Zilog Z8000|Z8000]]
*[[Zilog Z8000|Z8000]]
*[[Zilog Z800|Z800]]/[[Zilog Z280|Z280]]
*[[Zilog Z800|Z800]]/[[Zilog Z280|Z280]]
*[[Zilog Z180|Z180]]
*[[Zilog Z180|Z180]]
*Z380
*[[Zilog Z380|Z380]]
*[[Zilog eZ80|eZ80]]}}
*[[Zilog eZ80|eZ80]]}}
}}
}}
The [[Zilog]] '''Z80''' is an [[8-bit computing|8-bit]] [[Central Processing Unit|processor]] that is a software-compatible extension of the [[Intel 8080]]. In addition to having a binary compatible [[Instruction Set Architecture|ISA]] to the 8080, the processor offered many different improvements which allowed the Z80 to become the most widely used CPUs in desktop and home computers from the 1970s to the mid-1980s.
The [[Zilog]] '''Z80''' is an [[8-bit computing|8-bit]] [[Central Processing Unit|processor]] that is a software-compatible extension of the [[Intel 8080]]. In addition to having a binary compatible [[Instruction Set Architecture|ISA]] to the 8080, the processor offered many different improvements which allowed the Z80 to become the most widely used CPUs in desktop and home computers from the 1970s to the mid-1980s.
== Design ==
=== Registers ===
{| class="infobox" style="font-size:88%;width:32em;"
|-
|+ Zilog Z80 registers
|-
|
{| style="font-size:88%;"
|-
| style="width:10px; text-align:center;"| <sup>1</sup><sub>5</sub>
| style="width:10px; text-align:center;"| <sup>1</sup><sub>4</sub>
| style="width:10px; text-align:center;"| <sup>1</sup><sub>3</sub>
| style="width:10px; text-align:center;"| <sup>1</sup><sub>2</sub>
| style="width:10px; text-align:center;"| <sup>1</sup><sub>1</sub>
| style="width:10px; text-align:center;"| <sup>1</sup><sub>0</sub>
| style="width:10px; text-align:center;"| <sup>0</sup><sub>9</sub>
| style="width:10px; text-align:center;"| <sup>0</sup><sub>8</sub>
| style="width:10px; text-align:center;"| <sup>0</sup><sub>7</sub>
| style="width:10px; text-align:center;"| <sup>0</sup><sub>6</sub>
| style="width:10px; text-align:center;"| <sup>0</sup><sub>5</sub>
| style="width:10px; text-align:center;"| <sup>0</sup><sub>4</sub>
| style="width:10px; text-align:center;"| <sup>0</sup><sub>3</sub>
| style="width:10px; text-align:center;"| <sup>0</sup><sub>2</sub>
| style="width:10px; text-align:center;"| <sup>0</sup><sub>1</sub>
| style="width:10px; text-align:center;"| <sup>0</sup><sub>0</sub>
| style="width:auto;" | ''(bit position)''
|-
|colspan="17" | '''Main registers'''
|- style="background:silver;color:black"
| style="text-align:center;" colspan="8"| A
| style="text-align:center;background:#DDD" colspan="8"| Flags
| style="background:white; color:black;"| '''AF''' (8 bit accumulator and flags)
|- style="background:silver;color:black"
| style="text-align:center;" colspan="8"| B
| style="text-align:center;" colspan="8"| C
| style="background:white; color:black;"| '''BC''' (data and address register)
|- style="background:silver;color:black"
| style="text-align:center;" colspan="8"| D
| style="text-align:center;" colspan="8"| E
| style="background:white; color:black;"| '''DE''' (data and address register)
|- style="background:silver;color:black"
| style="text-align:center;" colspan="8"| H
| style="text-align:center;" colspan="8"| L
| style="background:white; color:black;"| '''HL''' (16 bit accumulator and address register)
|-
|colspan="17" | '''Alternate registers'''
|- style="background:silver;color:black"
| style="text-align:center;" colspan="8"| A'
| style="text-align:center;background:#DDD" colspan="8"| Flags'
| style="background:white; color:black;"| '''AF{{'}}''' (8 bit accumulator and flags)
|- style="background:silver;color:black"
| style="text-align:center;" colspan="8"| B'
| style="text-align:center;" colspan="8"| C'
| style="background:white; color:black;"| '''BC{{'}}''' (data and address register)
|- style="background:silver;color:black"
| style="text-align:center;" colspan="8"| D'
| style="text-align:center;" colspan="8"| E'
| style="background:white; color:black;"| '''DE{{'}}''' (data and address register)
|- style="background:silver;color:black"
| style="text-align:center;" colspan="8"| H'
| style="text-align:center;" colspan="8"| L'
| style="background:white; color:black;"| '''HL{{'}}''' (16 bit accumulator and address register)
|-
|colspan="17" | '''Index registers'''
|- style="background:silver;color:black"
| style="text-align:center;" colspan="16"| IX
| style="background:white; color:black;"| '''I'''ndex '''X'''
|- style="background:silver;color:black"
| style="text-align:center;" colspan="16"| IY
| style="background:white; color:black;"| '''I'''ndex '''Y'''
|- style="background:silver;color:black"
| style="text-align:center;" colspan="16"| SP
| style="background:white; color:black;"| '''S'''tack '''P'''ointer
|-
|colspan="17" | '''Other registers'''
|- style="background:silver;color:black"
| style="background:white; color:black;" colspan="8"| &nbsp;
| style="text-align:center;" colspan="8"| I
| style="background:white; color:black;"| '''I'''nterrupt vector
|- style="background:silver;color:black"
| style="background:white; color:black;" colspan="8"| &nbsp;
| style="text-align:center;" colspan="8"| R
| style="background:white; color:black;"| '''R'''efresh counter
|-
|colspan="17" | '''Program counter'''
|- style="background:silver;color:black"
| style="text-align:center;" colspan="16"| PC
| style="background:white; color:black;"| '''P'''rogram '''C'''ounter
|-
|colspan="17" | '''Status register'''
|- style="background:silver;color:black"
| style="background:white; color:black;" colspan="8"| &nbsp; <!--NEED TO ADD INTERRUPT STATUS/MODE BITS-->
| style="text-align:center;"| [[Sign flag|S]]
| style="text-align:center;"| [[Zero flag|Z]]
| style="text-align:center;"| -
| style="text-align:center;"| [[Adjust flag|H]]
| style="text-align:center;"| -
| style="text-align:center;"| [[Parity flag|P]]/[[Overflow flag|V]]
| style="text-align:center;"| N
| style="text-align:center;"| [[Carry flag|C]]
| style="background:white; color:black" | '''F'''lags
|}
|}
There are seven 8-bit general [[Processor register|registers]] ('''A''', '''B''', '''C''', '''D''', '''E''', '''H''' and '''L''') where A is the primary 8-bit [[accumulator]], eight [[Shadow register|shadow registers]] ('''A'<nowiki/>''', '''F'<nowiki/>''', '''B'<nowiki/>''', '''C'<nowiki/>''', '''D'''', '''E'''', '''H'''' and '''L''''), two 16-bit [[Index register|index registers]] ('''IX''' and '''IY'''), two external [[Control register|control registers]] ('''I''', and '''R''') and one status register. The six general registers can be used as either individual 8-bit registers or in three 16-bit register pairs ('''BC''', '''DE''' and '''HL''') depending on the particular instruction. Specific instructions allow the use of accessing the lower and upper bytes of the two 16-bit index registers (as '''IXL''', '''IXH''', '''IYL''' and '''IYH''' respectively).
The '''AF'''' register is the only shadow register which can be used as a parameter. The AF' shadow register can only be used with the <code>EX AF, AF'</code> instruction. The other three remaining shadow registers can be exchanged at once using the <code>EXX</code> instruction.
The [[refresh register]] ('''R''') provides the computer the capability of refreshing [[dynamic access memory]], as it increments every fetch of an opcode or opcode prefix.
The [[interrupt vector register]] ('''I''') is used when the interrupt mode is IM2, to set the upper 8 bits of the [[interrupt vector]]. When an interrupt is received in this mode, a byte will be passed by the interrupting device. The byte passed by the interrupting device will be combined with the interrupt vector register shifted by 8 to form the complete 16-bit address to the vector table. When interrupt modes IM0 and IM1 are used, the interrupt vector register can be used as a limited extra register.
==== Flags ====
The processor maintains an internal [[status register]] for storing [[Flag word|bit flags]] representing the state of arithmetic and logic operations.
* [[Sign flag|Sign]] (S), set if the result is negative.
* [[Zero flag|Zero]] (Z), set if the result is zero.
* [[Auxiliary carry flag|Half-carry]] (H), used for [[binary-coded decimal]] (BCD) arithmetic.
* [[Parity flag|Parity]]/[[Overflow flag|Overflow]] (P/V), set if the number of bits set to 1 is even or if the operation resulted in an overflow.
* Add/Subtract (N), set to distinguish between addition and subtraction during decimal adjust accumulator instructions. All additions, N = 0; all subtractions, N = 1.
* [[Carry flag|Carry]] (C), set if the last addition operation resulted in a carry, or the last subtraction operation resulted in a borrow.
=== Input/Output control ===
The Z80 supports up to 256 independent I/O ports, accessed through dedicated I/O instructions taking port addresses as operands.
== Pinouts ==
{| class="wikitable"
! Pin number
! Signal
! Type
! Comment
|-
|1
|A11
| rowspan="5" |Output
| rowspan="5" |Address bus [11..15], Trisate
|-
|2
|A12
|-
|3
|A13
|-
|4
|A14
|-
|5
|A15
|-
|6
|CLK
|Input
|Clock
|-
|7
|D4
| rowspan="4" |Bidirectional
| rowspan="4" |Data bus [3..6], Tristate
|-
|8
|D3
|-
|9
|D5
|-
|10
|D6
|-
|11
|V<sub>CC</sub>
|—
| +5V power supply
|-
|12
|D2
| rowspan="4" |Bidirectional
| rowspan="4" |Data bus [0..2, 7], Tristate
|-
|13
|D7
|-
|14
|D0
|-
|15
|D1
|-
|16
|{{Overline|INT}}
| rowspan="2" |Input
|Interrupt request
|-
|17
|{{Overline|NMI}}
|Non-maskable interrupt request
|-
|18
|{{Overline|HALT}}
| rowspan="6" |Output
|Halt. Indicates the processor is stopped. A signal on {{Overline|RESET}} is required to resume
|-
|19
|{{Overline|MREQ}}
|Memory request. Indicates the processor is requesting or writing data from/to a memory address
|-
|20
|{{Overline|IORQ}}
|Input/Output request. Indicates the processor is requesting or writing data from/to am I/O port
|-
|21
|{{Overline|RD}}
|Read. Indicates the processor is reading data
|-
|22
|{{Overline|WR}}
|Write. Indicates the processor is writing data
|-
|23
|{{Overline|BUSACK}}
|Bus Acknowledge. Indicates to the requesting device that the CPU address bus, data bus, and control signals {{Overline|MREQ}}, {{Overline|IORQ}}, {{Overline|RD}} and {{Overline|WR}} have entered their high-impedance state. The external circuitry can now control these lines
|-
|24
|{{Overline|WAIT}}
| rowspan="3" |Input
|Wait. This introduces wait-states in to the current machine cycle for as long as this signal is active. Extended {{Overline|WAIT}} periods can prevent the CPU from properly refreshing dynamic memory
|-
|25
|{{Overline|BUSRQ}}
|Bus request. Has a high priority than {{Overline|NMI}} and is always recognized at the end of the current machine cycle. Forces the CPU address bus, data bus, and control signals {{Overline|MREQ}}, {{Overline|IORQ}}, {{Overline|RD}} and {{Overline|WR}} to enter their high-impedance state
|-
|26
|{{Overline|RESET}}
|Reset. Initializes the CPU as follows: it resets the interrupt flip-flop, clears the Program Counter (PC) and registers I and R, and sets the interrupt mode to 0. During reset time, the address and data busses enter a high-impedance state, and all control output signals enter an inactive state. {{Overline|RESET}} must be active for a minimum of three full clock cycles before a reset operation is complete
|-
|27
|{{Overline|M1}}
| rowspan="2" |Output
|Machine Cycle One. {{Overline|M1}} combined with {{Overline|MREQ}}, indicates that the current machine cycle is the op code fetch cycle of an instruction execution. {{Overline|M1}} combined with {{Overline|IORQ}}, indicates an interrupt acknowledge cycle
|-
|28
|{{Overline|RFSH}}
|Refresh. {{Overline|RFSH}} combined with {{Overline|MREQ}}, indicates that the lower seven bits of the address bus can be used as a refresh address for dynamic memory
|-
|29
|GND
|—
|Ground
|-
|30
|A0
| rowspan="11" |Output
| rowspan="11" |Address bus [0..10], Tristate
|-
|31
|A1
|-
|32
|A2
|-
|33
|A3
|-
|34
|A4
|-
|35
|A5
|-
|36
|A6
|-
|37
|A7
|-
|38
|A8
|-
|39
|A9
|-
|40
|A10
|}
{{Stub}}
[[Category:Zilog Microprocessors]]
[[Category:Zilog Microprocessors]]
[[Category:Microprocessors]]
[[Category:8-bit microprocessors]]

Latest revision as of 04:21, 18 February 2024

Zilog Z80
General information
LaunchedMarch 1976
Common manufacturer(s)
Performance
Max. CPU clock rate2.5 MHz to 20 MHz
Data width8 bits
Address width16 bits
Architecture and classification
Instruction setZ80
Physical specifications
Package(s)
Socket(s)
  • Not applicable
History
Successor(s)

The Zilog Z80 is an 8-bit processor that is a software-compatible extension of the Intel 8080. In addition to having a binary compatible ISA to the 8080, the processor offered many different improvements which allowed the Z80 to become the most widely used CPUs in desktop and home computers from the 1970s to the mid-1980s.

Design

Registers

Zilog Z80 registers
15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00 (bit position)
Main registers
A Flags AF (8 bit accumulator and flags)
B C BC (data and address register)
D E DE (data and address register)
H L HL (16 bit accumulator and address register)
Alternate registers
A' Flags' AF' (8 bit accumulator and flags)
B' C' BC' (data and address register)
D' E' DE' (data and address register)
H' L' HL' (16 bit accumulator and address register)
Index registers
IX Index X
IY Index Y
SP Stack Pointer
Other registers
  I Interrupt vector
  R Refresh counter
Program counter
PC Program Counter
Status register
  S Z - H - P/V N C Flags

There are seven 8-bit general registers (A, B, C, D, E, H and L) where A is the primary 8-bit accumulator, eight shadow registers (A', F', B', C', D', E', H' and L'), two 16-bit index registers (IX and IY), two external control registers (I, and R) and one status register. The six general registers can be used as either individual 8-bit registers or in three 16-bit register pairs (BC, DE and HL) depending on the particular instruction. Specific instructions allow the use of accessing the lower and upper bytes of the two 16-bit index registers (as IXL, IXH, IYL and IYH respectively).

The AF' register is the only shadow register which can be used as a parameter. The AF' shadow register can only be used with the EX AF, AF' instruction. The other three remaining shadow registers can be exchanged at once using the EXX instruction.

The refresh register (R) provides the computer the capability of refreshing dynamic access memory, as it increments every fetch of an opcode or opcode prefix.

The interrupt vector register (I) is used when the interrupt mode is IM2, to set the upper 8 bits of the interrupt vector. When an interrupt is received in this mode, a byte will be passed by the interrupting device. The byte passed by the interrupting device will be combined with the interrupt vector register shifted by 8 to form the complete 16-bit address to the vector table. When interrupt modes IM0 and IM1 are used, the interrupt vector register can be used as a limited extra register.

Flags

The processor maintains an internal status register for storing bit flags representing the state of arithmetic and logic operations.

  • Sign (S), set if the result is negative.
  • Zero (Z), set if the result is zero.
  • Half-carry (H), used for binary-coded decimal (BCD) arithmetic.
  • Parity/Overflow (P/V), set if the number of bits set to 1 is even or if the operation resulted in an overflow.
  • Add/Subtract (N), set to distinguish between addition and subtraction during decimal adjust accumulator instructions. All additions, N = 0; all subtractions, N = 1.
  • Carry (C), set if the last addition operation resulted in a carry, or the last subtraction operation resulted in a borrow.

Input/Output control

The Z80 supports up to 256 independent I/O ports, accessed through dedicated I/O instructions taking port addresses as operands.

Pinouts

Pin number Signal Type Comment
1 A11 Output Address bus [11..15], Trisate
2 A12
3 A13
4 A14
5 A15
6 CLK Input Clock
7 D4 Bidirectional Data bus [3..6], Tristate
8 D3
9 D5
10 D6
11 VCC +5V power supply
12 D2 Bidirectional Data bus [0..2, 7], Tristate
13 D7
14 D0
15 D1
16 INT Input Interrupt request
17 NMI Non-maskable interrupt request
18 HALT Output Halt. Indicates the processor is stopped. A signal on RESET is required to resume
19 MREQ Memory request. Indicates the processor is requesting or writing data from/to a memory address
20 IORQ Input/Output request. Indicates the processor is requesting or writing data from/to am I/O port
21 RD Read. Indicates the processor is reading data
22 WR Write. Indicates the processor is writing data
23 BUSACK Bus Acknowledge. Indicates to the requesting device that the CPU address bus, data bus, and control signals MREQ, IORQ, RD and WR have entered their high-impedance state. The external circuitry can now control these lines
24 WAIT Input Wait. This introduces wait-states in to the current machine cycle for as long as this signal is active. Extended WAIT periods can prevent the CPU from properly refreshing dynamic memory
25 BUSRQ Bus request. Has a high priority than NMI and is always recognized at the end of the current machine cycle. Forces the CPU address bus, data bus, and control signals MREQ, IORQ, RD and WR to enter their high-impedance state
26 RESET Reset. Initializes the CPU as follows: it resets the interrupt flip-flop, clears the Program Counter (PC) and registers I and R, and sets the interrupt mode to 0. During reset time, the address and data busses enter a high-impedance state, and all control output signals enter an inactive state. RESET must be active for a minimum of three full clock cycles before a reset operation is complete
27 M1 Output Machine Cycle One. M1 combined with MREQ, indicates that the current machine cycle is the op code fetch cycle of an instruction execution. M1 combined with IORQ, indicates an interrupt acknowledge cycle
28 RFSH Refresh. RFSH combined with MREQ, indicates that the lower seven bits of the address bus can be used as a refresh address for dynamic memory
29 GND Ground
30 A0 Output Address bus [0..10], Tristate
31 A1
32 A2
33 A3
34 A4
35 A5
36 A6
37 A7
38 A8
39 A9
40 A10