Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

COP8

From Wikipedia, the free encyclopedia
This article is about COP8 microcontroller. For 8th Climate Change Conference of the Parties, see2002 United Nations Climate Change Conference.
8-bit microcontroller
National Semiconductor COP8
General information
Launched1988; 37 years ago (1988)
Common manufacturer
Performance
Max.CPUclock rate0 Hz to 2 MHz
Data width8 (RAM), 8 (ROM)
Address width8 (RAM), 15 (ROM)
Architecture and classification
ApplicationEmbedded
Instruction setCOP8
Number of instructions69
Physical specifications
Package
  • 20, 28, and 40-pinDIP; 16, 20, and 28 pinSOIC; 44-pinPLCC
History
PredecessorCOP400
Successornone

TheNational SemiconductorCOP8 is an 8-bitCISC coremicrocontroller. COP8 is an enhancement to the earlierCOP400 4-bit microcontroller family. COP8 main features are:

  • Large amount ofI/O pins
  • Up to 32 KB ofFlash memory/ROM for code and data
  • Very lowEMI
  • Many integrated peripherals (meant as single chip design)
  • In-System Programming
  • Freeassembler toolchain. CommercialC compilers available
  • Free Multitasking OS andTCP/IP stack
  • Peak of 2 million instructions per second

The COP8 has a basic instruction cycle time 1/10 of the clock frequency; a maximum 10 MHz clock will result in a maximum 1 MHz instruction execution rate. (The 10 MHz clock is used directly by some timer peripherals.) The maximum instruction execution rate is 1 cycle per byte, and most 1-byte instructions operate in one instruction cycle. Some, particularly branch instructions, take one or two cycles more. Some models include a clock doubler, and although they still accept a maximum 10 MHz input clock, they internally double it to a 20 MHz master clock which then results in a 2 MHz instruction execution rate.[1]: 7,32 

The chip is astatic logic design which can tolerate an arbitrarily slow clock;[1]: 10  most models include a second32768 Hzquartz clock crystal oscillator which can be used for the CPU clock while the high-speed clock is disabled to save power.

Registers and memory map

[edit]
COP8 registers
141312111009080706050403020100(bit position)
Main registers
AAccumulator
PCUPCLProgram Counter
Note: All other programmer-visible registers and status bits are allocated in RAM.

The COP8 uses separate instruction and data spaces (Harvard architecture).[2]: 2-1 [3]: 2-4  Instruction address space is 15-bit (32 KiB maximum), while data addresses are 8-bit (256 bytes maximum, extended via bank-switching).

To allow software bugs to be caught, all invalid instruction addresses read as zero, which is a trap instruction. Invalid RAM above the stack reads as all-ones, which is an invalid address.

The CPU has an 8-bit accumulator and 15-bitprogram counter. 16 additional 8-bit registers (R0–R15) and an 8-bitprogram status word are memory mapped. There are special instructions to access them, but general RAM access instructions may also be used.

The memory map is divided into half RAM and half control registers as follows:

COP8 data address space
AddressesUse
0x00–6FGeneral purpose RAM, used for stack
0x70–7FUnused, reads as all-ones (0xFF) to trap stack underflows
0x80–8FUnused, reads undefined
0x90–BFAdditional peripheral control registers
0xC0–CFPeripheral control registers.
0xD0–DFGeneral purpose I/O ports L, G, I, C and D
0xE0–E8Reserved
0xE9Microwire shift register
0xEA–EDTimer 1 registers
0xEECNTRL register, control bits for Microwire & Timer 1
0xEFPSW, CPU program status word
0xF0–FBR0–R11, on-chip RAM mapped as registers
0xFCR12, a.k.a. X, secondary indirect pointer register
0xFDR13, a.k.a. SP, stack pointer register
0xFER14, a.k.a. B, primary indirect pointer register
0xFFR15, a.k.a. S, data segment extension register

If RAM is not banked, then R15 (S) is just another general-purpose register. If RAM is banked, then the low half of the data address space (addresses 0x00–7F) is directed to a RAM bank selected by S. The special purpose registers in the high half of the data address space are always visible. The data registers at 0xFx can be used to copy data between banks.

RAM banks other than bank 0 have all 128 bytes available. The stack (addressed via the stack pointer) is always on bank 0, no matter how the S register is set.

Control transfers

[edit]

In addition to 3-byteJMPL andJSRL instructions which can address the entire address space, 2-byte versions of these instructions,JMP andJSR, can jump within a 4K page. The instruction specifies the low 12 bits, and the high 3 bits of the PC are preserved. (These are intended primarily for models with up to 4K of ROM.) For short-distance branches, there are 63 1-byte instructions,JP, which perform PC-relative branches from PC−32 to PC+31. This is a 15-bit addition, and no page boundary requirements apply.

There are also jump indirect and load accumulator indirect instructions which use the accumulator contents as the low 8 bits of an address; the high 7 bits of the current PC are preserved.

Conditional branchesper se do not exist, nor does the processor provide thetraditional ZCVN status flags, although the program status word containscarry andhalf-carry flags for multi-byte arithmetic. Rather, there are a number of compare-and-skip instructions. For example,IFEQ compares its two operands, and skips the following instruction if they are unequal. Any instruction may be skipped; it is not limited to branches.

An interesting extension of this mechanism is theRETSK return-and-skip instruction, which lets any subroutine conditionally skip the instruction following the call. This provides a very compact way to return aboolean value from a subroutine.

Another feature unique to the COP8 architecture is theIFBNE instruction. This one-byte instruction compares the low 4 bits of the B (memory pointer) register with a 4-bit immediate constant, and can be used to loop until B has reached the end of a small (up to 16 byte) buffer. There is also a one-byteLD B,#imm4 instruction.

Instruction set

[edit]

COP8 operands are listed in destination, source order. Most instructions have the accumulator A as one of the operands. The other operand is generally chosen from an 8-bit immediate value, an 8-bit RAM address, or[B], the RAM address selected by the B register. TheLD andX (exchange with accumulator) instructions also support RAM addressing by the X register ([X]) and post-inc/decrement variants ([B+],[B−],[X+],[X−]).

Indirect addressing via B is particularly fast, and can be done in the same cycle that the instruction is executed; evenX A,[B] is a one-cycle instruction.

On the other hand, absolute RAM addressing is only directly encoded for five instructions:LD A,addr8,X A,addr8,IFEQaddr8,#imm8,LDaddr8,#imm8, andDIRaddr8. The latter is a "direct addressing" prefix opcode which may be prepended to any instruction with a[B] operand, and changes the operand to the specified memory location. (Conditional-skip instructions skip the prefix and following instruction as a pair.) UsingDIR with theLD A,[B],X A,[B] andLD [B],#imm8 instructions is not documented, as the dedicated instructions are more efficient.

All "move" instructions are calledLD (load) even if the destination is a memory address (LDaddr8,#imm8). Unusually, there are noLD instructions with the accumulator as a source; stores must be done with theX instruction whichexchanges the accumulator with the memory operand, storing A and loading the previous memory contents.

There are instructions to fetch from tables in ROM. These combine the high 7 bits of the program counter (PCU) with the accumulator, fetch a byte from that address, and place it in the accumulator (LAID instruction) or the low 8 bits of the program counter PCL (JID instruction). Because the next instruction executed must be in the same 256-byte page of ROM as the table itself, a 256-entry table is not possible.

COP8 family instruction set[2][4][3][5]
OpcodeOperandsMnemonicCyclesDescription
76543210b2b3
00000000INTR7Software interrupt (push PC, PC ← 0x00ff)
000offsetJP +disp53PC ← PC +offset; jump 1–31 bytes forward (offset≠0)
0010highlowJMPaddr123PC[11:0] ←addr. Top 3 bits of PC preserved.
0011highlowJSRaddr125Jump to subroutine: push PC, proceed as JMP.
0100kIFBNE #imm41Skip next instruction if (B & 15) =k.
0101kLD B,#imm41B ← 15 −k (zero-extended)
01100opcodeMiscellaneous instructions
01100000kANDSZ A,#imm8[a]2Skip if A &k = 0 (=IFBIT #bit,A)
01100001addrJSRBaddr8[b]5Push PC, jump to boot ROM subroutine at address[1]
0110001(reserved for boot ROM)[b][1]
01100100CLR A1A ← 0
01100101SWAP A1A ← A<<4 | A>>4; swap nibbles
01100110DCOR A1Decimal correct afterBCD addition
01100111PUSH A[a]3[SP] ← A, SP ← SP−1
011opcbitBit operations on [B][c]
01101bitRBIT #bit,[B][c]1Reset (clear to 0) given bit of RAM
01110bitIFBIT #bit,[B][c]1Test given bit of RAM, skip if zero
01111bitSBIT #bit,[B][c]1Set (to 1) given bit of RAM
100m0opcodek?Binary operations, A ← A opoperand
10000opcodeOP A,[B][c]1A ← A op [B]
10010opcodekOP A,#imm82A ← A opk
100m0000k?ADC A,operandC,A ← A +operand + C; add with carry
100m0001k?SUBC A,operandC,A ← A + ~operand + C (A −operand − ~C)
100m0010k?IFEQ A,operandSkip if A ≠operand
100m0011k?IFGT A,operandSkip if A ≤operand
100m0100k?ADD A,operandA ← A +operand (carry unchanged!)
100m0101k?AND A,operandA ← A &operand
100m0110k?XOR A,operandA ← A ^operand
100m0111k?OR A,operandA ← A |operand
10001opcodeZero-operand instructions
10001000IFC1Skip if carry clear
10001001IFNC1Skip if carry set
10001010INC A1A ← A + 1 (carry unchanged)
10001011DEC A1A ← A − 1 (carry unchanged)
10001100POP A[a]3SP ← SP+1, A ← [SP]
10001101RETSK5Pop PC, skip one instruction
10001110RET5Pop PC high, pop PC low
10001111RETI5Return and enable interrupts
10011opcodekInstructions with immediate operand
10011000kLD A,#imm82A ←k
10011001kIFNE A,#imm8[a]2Skip if A =k
10011010kLD [B+],#imm83[B] ←k, B ← B + 1
10011011kLD [B−],#imm83[B] ←k, B ← B − 1
10011100addrX A,addr83A ↔ [addr], exchange
10011101addrLD A,addr83A ← [addr]
10011110kLD [B],#imm82[B] ←k
10011111kLD B,#imm8[a]2B ←k (=LD R14,#k, one cycle faster)
101opcode0cMiscellaneous instructions
10100000RC1C ← 0; reset carry to 0
10100001SC1C ← 1; set carry to 1
10100100LAID3A ← ROM[PCU:A]; load from ROM
10100101JID3PCL ← ROM[PCU:A]; jump via ROM table
10101000RLC A[a]1C,A ← A,C; rotate left through carry (=ADC A,A)
10101001addrkIFEQaddr8,#imm8[a]3Skip if [addr] ≠k
10101100highlowJMPLaddr154PC ←address
10101101highlowJSRLaddr155Push PC, PC ←address
10110000RRC A1A,C ← C,A; rotate right through carry
10110001(reserved)
10110100VIS[a]5PC ← ROM[vector table]; Vector Interrupt Select
10110101RPND[a]1Reset pending interrupt flag
10111000NOP1No operation
10111001IFNE A,[B][a][c]1Skip if A = [B]
10111100addrkLDaddr8,#imm83[addr] ←k
10111101addrDIRaddr83Change next instruction's operand from [B] to [addr]
101RL=1±Load/exchange operations
10100010X A,[B+]2A ↔ [B], B ← B+1
10100011X A,[B−]2A ↔ [B], B ← B−1
10100110X A,[B]1A ↔ [B]
10101010LD A,[B+]2A ← [B], B ← B+1
10101011LD A,[B−]2A ← [B], B ← B−1
10101110LD A,[B]1A ← [B]
10110010X A,[X+]3A ↔ [X], X ← X+1
10110011X A,[X−]3A ↔ [X], X ← X−1
10110110X A,[X]3A ↔ [X]
10111010LD A,[X+]3A ← [X], X ← X+1
10111011LD A,[X−]3A ← [X], X ← X−1
10111110LD A,[X]3A ← [X]
101111(reserved)
1100registerDRSZregister3registerregister − 1, skip if result is zero
1101registerkLDregister,#imm83registerk (=LD 0xf0+register,#k, one byte shorter)
111offsetJP −disp53PC ← PC − 32 +offset; jump 1–32 bytes backward
76543210b2b3MnemonicCyclesDescription
  1. ^abcdefghijOnly on "feature family" (COP888/COP8SA) cores; not present on "basic family" (COP800) cores.
  2. ^abOnly on "flash family" (COP8TA/COP8C) models with boot ROM forin-system programming.
  3. ^abcdefOperand may be changed from[B] to 8-bit absolute address with aDIR prefix (+2 bytes, +3 cycles).

Notable uses

[edit]

References

[edit]
  1. ^abcd"COP8SBR9/COP8SCR9/COP8SDR98-Bit CMOS Flash Based Microcontroller with 32k Memory, Virtual EEPROM and Brownout"(PDF) (data sheet).National Semiconductor. April 2002. Retrieved2021-01-06.
  2. ^abCOP8 Basic Family User's Manual(PDF). Revision 002.National Semiconductor. June 1996. Literature Number 620895-002. Retrieved2021-01-02.
  3. ^abAleaf, Abdul (July 1996)."Comparison of COP878x to the Enhanced COP8SAx7 Family - Hardware/Software Considerations"(PDF).National Semiconductor. Application Note 1043.
  4. ^COP8 Feature Family User's Manual. Revision 005.National Semiconductor. March 1999. Literature Number 620897-005. Extracted fromzippedISO image530094-003_COP8_Tools_Docs_Aug1999.zip, retrieved 2020-01-07.
  5. ^"COP8SAx Designer's Guide"(PDF).National Semiconductor. January 1997. Literature Number 620894-001.
  6. ^Liberatore, David (11 May 2006).FMU-139C/B Electronic Bomb Fuze Design Update(PDF). 50th Annual NDIA Fuze Conference. Retrieved7 Nov 2024.
  7. ^Dennis, Marc; Hanrahan, Bob; Brackmann, Chris (November 1991).Application Note 761 - Electronic Fuzing(PDF). Texas Instruments. Retrieved7 Nov 2024.

External links

[edit]
Main
Architectures
Word length
4-bit
8-bit
16-bit
32-bit
64-bit
Interfaces
Programming
Debugging
Lists
See also
Retrieved from "https://en.wikipedia.org/w/index.php?title=COP8&oldid=1267885130"
Category:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp