请输入您要查询的百科知识:

 

词条 ST6 and ST7
释义

  1. ST6 architecture

  2. ST7 architecture

  3. References

{{confused|ST6 (disambiguation){{!}}ST6|ST7 (disambiguation){{!}}ST7}}{{split apart|date=October 2017|STMicroelectronics ST6|STMicroelectronics ST7}}

The ST6 and ST7 are 8-bit microcontroller product lines from STMicroelectronics. They are commonly used in small embedded applications like washing machines.

Although they use similar peripherals and are marketed as part of the same product line,[1][2] the two architectures are actually quite different.

Both have an 8-bit accumulator used for most operations, plus two 8-bit index registers (X and Y) used for memory addressing. Also both have 8-bit instructions followed by up to 2 bytes of operands, and both have support for manipulating and branching on individual bits of memory.

There, the similarities end.

The ST6 is a Harvard architecture with an 8-bit (256 byte) data address space and a separate 12-bit (4096 byte) program space. Operands are always 1 byte long, and some instructions support two operands, such as "move 8-bit immediate to 8-bit memory address". Subroutine calls are done using a separate hardware stack. Data registers (but not the program counter or flags) are memory-mapped.

The ST6's addressing modes are limited to immediate, 8-bit absolute memory address, and register indirect modes (X) and (Y).

The ST7 is a von Neumann architecture with a single 16-bit (64 kiB) address space. The first 256 bytes of RAM (the zero page) have extra flexibility. There are no two-operand instructions except for "test bit and branch". Its registers are not memory-mapped, and it uses general-purpose RAM (plus a stack pointer register) for subroutine calls.

The ST7 supports a wide variety of addressing modes, including base+index and double-indirect.

ST6 architecture

The ST6 has 64 bytes of RAM and 4096 bytes of program ROM. Larger amounts are accessed by bank-switching the low 2K section of the ROM.

The RAM address space is actually 256 bytes, divided as follows:

  • 0–63: Not implemented
  • 64–127: Bank-switchable window into program ROM and data EPROM.
  • 128–191: General-purpose RAM
  • 192–255: Peripheral control registers (GPIO ports, timers, etc.) The accumulator is mapped at address 255, but is more commonly addressed implicitly.

Not mapped into the address space is a 12-bit program counter and an associated hardware stack (four or six levels deep, depending on model). There are only two status bits (carry and zero), and they are banked based on processor mode, with separate status bits for normal, interrupt and non-maskable interrupt operation.

The first four general-purpose RAM locations are also known as the X, Y, V and W registers, and some instructions can access them using special short addressing modes. The X and Y registers serve as index registers, and can use indirect addressing modes (X) and (Y).

The instruction set consists of one byte of opcode, followed by up to two one-byte operands. The instruction set can be summarized as follows:

ST6 family instruction set[3]
7 6 5 4 3 2 1 0 b2 b3 Mnemonic C Z Description
offsetopc 0 Conditional branches (5-bit PC-relative)
offset 0 0 0 JRNZ addressJump to PC + simm5 if Z == 0
offset 1 0 0 JRZ addressJump to PC + simm5 if Z == 1
offset 0 1 0 JRNC addressJump to PC + simm5 if C == 0
offset 1 1 0 JRC addressJump to PC + simm5 if C == 1
imm4 c 0 0 1 imm8 Unconditional branches (12-bit absolute)
imm4 0 0 0 1 imm8 CALL imm12Push PC, jump to 12-bit address
imm4 1 0 0 1 imm8 JP imm12Jump to 12-bit address
opcode 1 0 1 Miscellaneous operations
0 0 1 0 1 (reserved)
reg 0 1 0 1 0 1 INC reg Z Increment X, Y, V or W. Z is set, C is not.
reg 1 1 0 1 0 1 LD A,reg Z A := {X, Y, V or W}
0 0 0 0 1 1 0 1 dst imm8 LDI dst,imm8Set destination to 8-bit immediate value
1 0 0 0 1 1 0 1 (reserved)
0 1 0 0 1 1 0 1 RETIReturn from interrupt. Pop PC, restore flags.
1 1 0 0 1 1 0 1 RETReturn from subroutine. Pop PC from hardware stack.
0 0 1 0 1 1 0 1 COM Z C Complement accumulator: A := ~A. C is set to previous msbit.
1 0 1 0 1 1 0 1 RLC A C A := A + A + C
0 1 1 0 1 1 0 1 STOPHalt processor, clock, most peripherals until next interrupt
1 1 1 0 1 1 0 1 WAITHalt processor until next interrupt; clock continues
reg 0 1 1 1 0 1 DEC reg Z Decrement X, Y, V or W. Z is set, C is not.
reg 1 1 1 1 0 1 LD reg,A Z {X, Y, V or W} := A
bitopc 0 1 1 address ? Bit operations
bit 0 0 0 1 1 src simm8 JRR bit,src,address C Jump to PC+simm8 if source bit is reset (clear)
bit 1 0 0 1 1 src simm8 JRS bit,src,address C Jump to PC+simm8 if source bit is set. C is a copy of tested bit.
bit 0 1 0 1 1 dst RES bit,dstReset (set to 0) given bit
bit 1 1 0 1 1 dst SET bit,dstSet (to 1) given bit
opcodedata 1 1 1 ? ALU operations with RAM or immediate
opcode 0 0 1 1 1 (X)Operand is (X)
opcode 0 1 1 1 1 (Y)Operand is (Y)
opcode 1 0 1 1 1 imm8 imm8Operand is 8-bit immediate (source only)
opcode 1 1 1 1 1 addr addrOperand is 8-bit RAM address
0 0 0 src 1 1 1 ? LD A,src Z A := src
1 0 0 dst 1 1 1 ? LD dst,A Z dst := A (immediate forbidden)
0 1 0 src 1 1 1 ? ADD A,src Z C A := A + src
1 1 0 src 1 1 1 ? SUB A,src Z C A := A − src
0 0 1 src 1 1 1 ? CP A,src Z C A − src
1 0 1 src 1 1 1 ? AND A,src Z A := A & src
0 1 1 dst 1 1 1 ? INC dst Z dst := dst + 1 (immediate forbidden)
1 1 1 dst 1 1 1 ? DEC dst Z dst := dst − 1 (immediate forbidden)

ST7 architecture

{{see also|STM8}}

The ST7 has six registers: the accumulator, X and Y index registers, stack pointer, program counter, and condition code register. Also, double-indirect addressing allows the zero page of RAM to serve as additional registers. An unusual but useful feature is that an interrupt pushes four of these registers on the stack (A and X as well as the usual PC and CC), and interrupt return restores them.

ALU instructions fall into two categories, two-operand and one-operand.

Two-operand instructions use the accumulator as the first source. The addressing mode specifies the second source, which may be:

  • 8-bit immediate
  • 8-bit absolute address
  • 16-bit absolute address
  • Indexed (X)
  • Indexed plus 8-bit offset (address8,X)
  • Indexed plus 16-bit offset (address16,X)

The destination is usually the accumulator, but a few instructions modify the second source. (Immediate operands are forbidden in such cases.)

One-operand instructions use the specified operand for both source and destination. The operand may be:

  • The accumulator A
  • The X register
  • 8-bit absolute address
  • Indexed (X)
  • Indexed plus 8-bit offset (address8,X)

Register plus offset computes a full-width sum, so the 8-bit form may address memory up to 255+255 = 510.

In addition to the above, there are three prefix bytes which may be prepended to any instruction for which they make sense:

  • PDY (0x90) changes all references to the X register to Y. This allows (Y), (address8,Y) and (address16,Y) addressing modes. This affects implicit operands as well, so the "load X" instruction becomes "load Y". A consequence of this is that load X can only use the X-relative addressing modes, and load Y can only use the Y-relative ones.
  • PIX (0x92) adds an indirection step to the instruction. The 8- or 16-bit address following the opcode byte is replaced by an 8-bit address of a memory location which holds an 8- or 16-bit address (the latter in big-endian order). This may then be indexed by the X register as usual. This allows (address8), (address16), ([address8],X) and ([address8.w],X) addressing modes.
  • PIY (0x91) combines the above effects. This allows the ([address8],Y) and ([address8.w],Y) addressing modes. (It may also be used with other modes as part of the "load Y" and "store Y" instructions.)
ST7 family instruction set[4]
7 6 5 4 3 2 1 0 b2 b3 Mnemonic Description
0 0 0 c bit v address ? Bit operations
0 0 0 0 bit 0 addr8 soff8 BTJT addr8,#bit,labelJump to PC + soff8 if source bit is true (set)
0 0 0 0 bit 1 addr8 soff8 BTJF addr8,#bit,labelJump to PC + soff8 if source bit is false (clear)
0 0 0 1 bit 0 addr8 BSET addr8,#bitSet specified bit to 1
0 0 0 1 bit 1 addr8 BRES addr8,#bitReset (clear) specified bit to 0
0 0 1 0 condition soff8 Conditional branches (8-bit relative offset)
0 0 1 0 0 0 0 0 soff8 JRA labelBranch always (true)
0 0 1 0 0 0 0 1 soff8 JRF labelBranch never (false)
0 0 1 0 0 0 1 0 soff8 JRUGT labelBranch if unsigned greater than (C=0 and Z=0)
0 0 1 0 0 0 1 1 soff8 JRULE labelBranch if unsigned less than or equal (C=1 or Z=1)
0 0 1 0 0 1 0 0 soff8 JRNC labelBranch if no carry (C=0)
0 0 1 0 0 1 0 1 soff8 JRC labelBranch if carry (C=1)
0 0 1 0 0 1 1 0 soff8 JRNE labelBranch if not equal (Z=0)
0 0 1 0 0 1 1 1 soff8 JREQ labelBranch if equal (Z=1)
0 0 1 0 1 0 0 0 soff8 JRNH labelBranch if not half-carry (H=0)
0 0 1 0 1 0 0 1 soff8 JRH labelBranch if half-carry (H=1)
0 0 1 0 1 0 1 0 soff8 JRPL labelBranch if plus (N=0)
0 0 1 0 1 0 1 1 soff8 JRMI labelBranch if minus (N=1)
0 0 1 0 1 1 0 0 soff8 JRNM labelBranch if not interrupt mask (M=0)
0 0 1 0 1 1 0 1 soff8 JRM labelBranch if interrupts masked (M=1)
0 0 1 0 1 1 1 0 soff8 JRIL labelBranch if interrupt line is low
0 0 1 0 1 1 1 1 soff8 JRIH labelBranch if interrupt line is high
0 modeopcode ? One-operand instructions
0 0 1 1 opcode addr8 OP addr88-bit absolute address
0 1 0 0 opcodeOP AAccumulator
0 1 0 1 opcodeOP XX register (Y register with prefix)
0 1 1 0 opcode addr8 OP (addr8,X)8-bit address plus X
0 1 1 1 opcodeOP (X)Indexed with no offset
0 mode 0 0 0 0 ? NEG operandTwo's-complement negate
0 mode 0 0 0 1 ? (reserved)
0 mode 0 0 1 0 ? (reserved)
0 1 0 0 0 0 1 0 MUL X,AX:A := X × A. (MUL Y,A with prefix)
0 mode 0 0 1 1 ? CPL operandOnes' complement, logical not
0 mode 0 1 0 0 ? SRL operandShift right logical. Msbit cleared, lsbit to carry.
0 mode 0 1 0 1 ? (reserved)
0 mode 0 1 1 0 ? RRC operandRotate right through carry, (operand:C) := (C:operand)
0 mode 0 1 1 1 ? SRA operandShift right arithmetic. Msbit preserved, lebit to carry.
0 mode 1 0 0 0 ? SLL operandShift left. Msbit to carry.
0 mode 1 0 0 1 ? RLC operandRotate left through carry.
0 mode 1 0 1 0 ? DEC operandDecrement. (N and Z set, carry unaffected)
0 mode 1 0 1 1 ? (reserved)
0 mode 1 1 0 0 ? INC operandIncrement. (N and Z set, carry unaffected)
0 mode 1 1 0 1 ? TNZ operandTest non-zero. Set N and Z based on operand.
0 mode 1 1 1 0 ? SWAP operandSwap halves of operand (4-bit rotate).
0 mode 1 1 1 1 ? CLR operandSet operand to 0. N and Z set to fixed values.operand.
1 0 0 opcodeMiscellaneous instructions. None implicitly set the condition codes.
1 0 0 0 0 0 0 0 IRETReturn from interrupt (pop CC, A, X, PC)
1 0 0 0 0 0 0 1 RETReturn from subroutine (pop PC)
1 0 0 0 0 0 1 0 TRAPForce trap interrupt
1 0 0 0 0 0 1 1 (reserved)
1 0 0 0 0 1 0 0 POP APop A from stack
1 0 0 0 0 1 0 1 POP XPop X from stack
1 0 0 0 0 1 1 0 POP CCPop condition codes from stack
1 0 0 0 0 1 1 1 (reserved)
1 0 0 0 1 0 0 0 PUSH APush A onto stack
1 0 0 0 1 0 0 1 PUSH XPush X onto stack
1 0 0 0 1 0 1 0 PUSH CCPush condition codes onto stack
1 0 0 0 1 0 1 1 (reserved)
1 0 0 0 1 1 0 (reserved)
1 0 0 0 1 1 1 0 HALTHalt processor and clocks
1 0 0 0 1 1 1 1 WFIWait for interrupt, halting processor but not clocks
1 0 0 1 0 0 0 0 PDYInstruction prefix; swap X and Y in next instruction
1 0 0 1 0 0 0 1 PIYInstruction prefix; PDY plus PIX
1 0 0 1 0 0 1 0 PIXInstruction prefix; use 8-bit memory indirect for operand
1 0 0 1 0 0 1 1 LD X,YX := Y. With PDY, does "LD Y,X".
1 0 0 1 0 1 0 0 LD S,XS := X. Load stack pointer.
1 0 0 1 0 1 0 1 LD S,AS := A. Load stack pointer.
1 0 0 1 0 1 1 0 LD X,SX := S.
1 0 0 1 0 1 1 1 LD X,AX := A.
1 0 0 1 1 0 0 0 RCFReset (clear) carry flag
1 0 0 1 1 0 0 1 SCFSet carry flag
1 0 0 1 1 0 1 0 RIMReset interrupt mask (enable interrupts)
1 0 0 1 1 0 1 1 SIMSet interrupt mask (disable interrupts)
1 0 0 1 1 1 0 0 RSPReset stack pointer (to top of RAM)
1 0 0 1 1 1 0 1 NOPNo operation. (=LD A,A)
1 0 0 1 1 1 1 0 LD A,SA := S
1 0 0 1 1 1 1 1 LD A,XA := X.
1 modeopcode value ? Two-operand instructions A := A op operand
1 0 1 0 opcode imm8 OP #imm88-bit immediate operand (forbidden as destination)
1 0 1 1 opcode addr8 OP addr88-bit absolute address
1 1 0 0 opcode addrhi addrlo OP addr1616-bit absolute address
1 1 0 1 opcode addrhi addrlo OP (addr16,X)Indexed with 16-bit offset
1 1 1 0 opcode addr8 OP (addr8,X)Indexed with 8-bit offset
1 1 1 1 opcodeOP (X)Indexed with no offset
1 mode 0 0 0 0 value ? SUB A,operandA := A − operand
1 mode 0 0 0 1 value ? CP A,operandCompare A − operand
1 mode 0 0 1 0 value ? SBC A,operandSubtract with borrow A := A − operand − C
1 mode 0 0 1 1 value ? CP X,operandCompare X − operand
1 mode 0 1 0 0 value ? AND A,operandA := A & operand, bitwise and
1 mode 0 1 0 1 value ? BCP A,operandBitwise test A & operand
1 mode 0 1 1 0 value ? LD A,operandLoad A := operand
1 0 1 0 0 1 1 1 imm8 (reserved, =LD #imm8,A)
1 mode 0 1 1 1 value ? LD operand,AStore operand := A
1 mode 1 0 0 0 value ? XOR A,operandA := A ^ operand, exclusive-or
1 mode 1 0 0 1 value ? ADC A,operandA := A + operand + C, add with carry
1 mode 1 0 1 0 value ? OR A,operandA := A {{!}} operand, inclusive or
1 mode 1 0 1 1 value ? ADD X,operandA := A + operand
1 0 1 0 1 1 0 0 imm8 x (reserved, =JP #imm8)
1 mode 1 1 0 0 value ? JP operandPC := operand, unconditional jump
1 0 1 0 1 1 0 1 soff8 CALLR labelPUSH PC, PC := PC + operand
1 mode 1 1 0 1 value ? CALL operandPush PC, PC := operand
1 mode 1 1 1 0 value ? LD X,operandLoad X := operand
1 0 1 0 1 1 1 1 imm8 (reserved, =LD #imm8,X)
1 mode 1 1 1 1 value ? LD operand,XStore operand := X

References

1. ^Datasheet: ST62T00C/T01C from 1998
2. ^{{cite web|title=2006 EDN Microcontroller/Microprocessor directory, 8-bit microprocessors sorted by Instruction Set Architecture |url=http://www.edn.com/contents/images/edn06mpd_8bit_ISA.pdf?industryid=45943|page=26}} 100616 edn.com
3. ^{{cite web |title=ST6 Family Programming Manual |version=Revision 2.0 |date=October 2004 |publisher=STMicroelectronics |url=http://www.st.com/content/ccc/resource/technical/document/programming_manual/4d/05/d1/a5/a0/9e/40/8b/CD00004606.pdf/files/CD00004606.pdf/jcr:content/translations/en.CD00004606.pdf#page=42 |page=42 |accessdate=2017-02-28}}
4. ^{{cite web |title=ST7 Family Programming Manual |version=Revision 2 |date=November 2005 |publisher=STMicroelectronics |url=http://www.st.com/content/ccc/resource/technical/document/programming_manual/f5/1c/5f/0c/c6/8f/44/73/CD00004607.pdf/files/CD00004607.pdf/jcr:content/translations/en.CD00004607.pdf |accessdate=2017-02-28}}
{{DEFAULTSORT:ST6 ST7}}

2 : Microcontrollers|Instruction set architectures

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/16 2:04:39