Download Print this page

Advertisement

Quick Links

May 2006
Introduction
The LatticeMico8™ is an 8-bit microcontroller optimized for Field Programmable Gate Arrays (FPGAs) and Cross-
over Programmable Logic Device architectures from Lattice. Combining a full 18-bit wide instruction set with
32 General Purpose registers, the LatticeMico8 is a flexible Verilog reference design suitable for a wide variety of
markets, including communications, consumer, computer, medical, industrial, and automotive. The core consumes
minimal device resources, less than 200 Look Up Tables (LUTs) in the smallest configuration, while maintaining a
broad feature set.
Features
• 8-bit Data Path
• 18-bit Wide Instructions
• 32 General Purpose Registers
• 32 bytes of Internal Scratch Pad Memory
• Input/Output is Performed Using "Ports" (Up to 256 Port Numbers)
• Optional 256 bytes of External Scratch Pad RAM
• Two Cycles Per Instruction
• Lattice UART Reference Design Peripheral
Functional Description
The following figure shows a block diagram of LatticeMico8 microcontroller.
Figure 1. LatticeMico8 Microcontroller Block Diagram
© 2006 Lattice Semiconductor Corp. All Lattice trademarks, registered trademarks, patents, and disclaimers are as listed at www.latticesemi.com/legal. All other brand
or product names are trademarks or registered trademarks of their respective holders. The specifications and information herein are subject to change without notice.
www.latticesemi.com
Program Flow Control and PC
Interrupt
rd
rb
From Mem
Program
instr
Memory
17:0
(EBR)
From I/O Port
LatticeMico8 Microcontroller
16 Deep Call Stack
value
op A
Register File
32 8-bit
Registers
op B
Immediate
value
Internal
32-byte Scratch
Pad Memory
Optional External
Scratch Pad
(up to 256 Bytes)
1
User's Guide
Reference Design RD1026
Interrupt Ack
Flags
CY, Z
ALU
ALU Op
To I/O Port
rd1026_01.2

Advertisement

loading

Summary of Contents for Lattice LatticeMico8

  • Page 1 From I/O Port © 2006 Lattice Semiconductor Corp. All Lattice trademarks, registered trademarks, patents, and disclaimers are as listed at www.latticesemi.com/legal. All other brand or product names are trademarks or registered trademarks of their respective holders. The specifications and information herein are subject to change without notice.
  • Page 2 LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide Register File The register file is implemented using dual ported distributed RAM. It contains 32 8-bit entries. Two values can be simultaneously read from the register file. Scratch Pad RAM (Internal) The internal scratch pad memory has 32 entries. It can be addressed directly or indirectly (via a register). Indirect addressing mode is not available if external scratch pad memory is attached.
  • Page 3: Scratch Pad Memory Access (External)

    LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide Figure 2. Microcontroller Read Cycle Using import , importi For export and exporti instructions, the ext_io_wr signal is strobed in the same cycle as the data out is driven. Both the ext_io_wr and the ext_dout are driven in the second cycle of instruction execution. Figure 3 shows the waveform corresponding to a write.
  • Page 4 LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide Instruction Sets Please note that for all Branch and Call instructions, the signed offset is represented as binary 2’s complement. ADD RD, Rb CY Flag Updated Zero Flag Updated Rd = Rd + Rb (add registers) The carry flag is updated with the carry out from the addition.
  • Page 5 LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide SUB Rd, Rb CY Flag Updated Zero Flag Updated Rd = Rd - Rb (subtract register from register) The carry flag is set to 1 if the result is negative. The zero flag is set to 1 if all the bits of the result are 0.
  • Page 6 LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide MOV Rd, Rb CY Flag Updated Zero Flag Updated Rd = Rb (move register to register) The zero flag is set to 1 if all the bits of the result are 0. MOVI Rd, C...
  • Page 7 LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide OR Rd, Rb CY Flag Updated Zero Flag Updated Rd = Rd | Rb (bitwise OR registers) The zero flag is set to 1 if all the bits of the result are 0. ORI Rd, C...
  • Page 8 LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide CMP Rd, Rb CY Flag Updated Zero Flag Updated Subtract Rb from Rd and update the flags. The result of the subtraction is not written back. The carry flag is set to 1 if the result is negative. The zero flag is set to 1 if all the bits of the result are 0.
  • Page 9 LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide ROR Rd, Rb CY Flag Updated Zero Flag Updated Rotate right. Register B is shifted right one bit, the highest order bit is replaced with the lowest order bit. The result is written back to Register Rd. The zero flag is set to 1 if all the bits of the result are 0.
  • Page 10 LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide ROLC Rd, Rb CY Flag Updated Zero Flag Updated Rotate left through carry. Register B is shifted left by one bit. The carry flag is shifted into the lowest order bit and the highest order bit is shifted into the carry flag. The zero flag is set to 1 if all the bits of the result are 0.
  • Page 11 LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide SETZ CY Flag Updated Zero Flag Updated Zero Flag = 1 Set zero flag. CLRI CY Flag Updated Zero Flag Updated Interrupt Enable Flag = 0 Clear interrupt enable flag. Disable interrupts. SETI CY Flag Updated...
  • Page 12 LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide BNZ Label CY Flag Updated Zero Flag Updated If Zero Flag = 0 then PC = PC + (Signed Offset of Label). Else PC = PC + 1. Branch if not 0. If zero flag is not set, the PC is incremented by the signed offset of the label from the current PC. If zero flag is set, then execution continues with the following instruction.
  • Page 13 LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide CALLZ Label CY Flag Updated Zero Flag Updated If Zero Flag = 1, then Push PC + 1 into Call Stack PC = PC + Signed Offset of LABEL Else, PC = PC + 1 CALL if 0.
  • Page 14 LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide CALLNC Label CY Flag Updated Zero Flag Updated If Carry Flag = 0, then Push PC + 1 into Call Stack PC = PC + Signed Offset of LABEL Else, PC = PC + 1 CALL if not carry.
  • Page 15 LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide Restore Zero and Carry Flags from shadow locations Return from interrupt. In addition to popping the call stack, the carry and zero flags are restored from shadow loca- tions. IMPORT Rd, Port# CY Flag Updated...
  • Page 16 LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide LSP Rd, SS CY Flag Updated Zero Flag Updated Rd = Scratch Pad(SS) Load from scratch pad memory direct. Load the value from the scratch pad location designated by constant SS into Register D. SS can be 0-31.
  • Page 17: Configuration Options

    The LatticeMico8 microcontroller has the following configurable features: • Register File size: LatticeMico8 can be configured to have 16 or 32 registers. Default configuration is 32 8-bit registers. Un-commenting the line `define REGISTERS_16, will configure the micro-controller with 16 registers.
  • Page 18 LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide • Verilog initialization file (included in design before synthesis) In addition to these outputs, the Assembler can also generate an assembler listing file. Command Line <executable filename> -option1 -option2 ... <input filename> Command Line Options...
  • Page 19 LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide • Octal values: Octal values must be prefixed with the numeric character ‘0’. (e.g. 077, 066, and 012 are valid octal constants). • Character constants: Single character constants must be enclosed in single quotation marks. (e.g. ‘A’, ‘v’, ‘9’...
  • Page 20: Instruction Set Simulator

    The Simulator can also be used to generate a disassembly listing of a LatticeMico8 program. The Simulator takes as input the memory output file of the Assembler. It emulates the instruction execution of the LatticeMico8 in software. Please note that the Simulator does not handle interrupts.
  • Page 21 -o isp8sim_win isp8sim.c Example To display the features and capabilities of the LatticeMico8, a demonstration example is also available. It demon- strates the interaction between the timer and the controller and the interrupt capability. # This program will allow user to run a fibonacci number # generator and updown counter.
  • Page 22 LatticeMico8 Microcontroller Lattice Semiconductor User’s Guide start: import r5, 5 mov r6, r5 andi r5, 0xf0 # masking r5 to decide type of program mov r7, r5 mov r5, r6 andi r5, 0x0f # masking r5 to get the speed...
  • Page 23: Technical Support Assistance

    62.3 (LFXP3C-4) LFEC3E-4 65.6 (LFEC3E-4) 32 - Regs, 32 - Int SP, Ext SP LCMXO1200C-4 70.8 (LCMXO1200C-4) LFE2-50E-5 86.2 (LFE2-50E-5) 1. SP = Scratch Pad Technical Support Assistance Hotline: 1-800-LATTICE (North America) +1-503-268-8001 (Outside North America) e-mail: techsupport@latticesemi.com Internet: www.latticesemi.com...