ZPU (processor)

Last updated

The ZPU is a microprocessor stack machine designed by Norwegian company Zylin AS to run supervisory code in electronic systems that include a field-programmable gate array (FPGA). [1]

Contents

The ZPU is a relatively recent stack machine with a small economic niche, and it has a growing number of users and implementations.[ citation needed ] It has been designed to require very small amounts of electronic logic, making more electronic logic available for other purposes in the FPGA. To make it easily usable, it has a port of the GNU Compiler Collection. This makes it much easier to apply than CPUs without compilers. Sacrificing speed in exchange for small size, it keeps the intermediate results of calculations in memory, in a push-down stack, rather than in registers. [1]

Zylin Corp. made the ZPU open-source in 2008. [1]

Usage

Many electronic projects include electronic logic in an FPGA. It is wasteful to also have a microprocessor, so it is commonplace to add a CPU to the electronic logic in the FPGA. Often, a smaller, less-expensive FPGA could be used if only the CPU used less resources. This is the exact situation that the ZPU was designed to address.

The ZPU is designed to handle the miscellaneous tasks of a system that are best handled by software, for example, a user interface. The ZPU is very slow, but its small size helps to place any needed high-speed algorithm in the FPGA.

Another issue is that most CPUs for FPGAs are closed-source, available only from a particular maker of FPGAs. Occasionally a project needs to have a design that can be widely distributed, for security inspections, educational uses or other reasons. The licenses on these proprietary CPUs can prevent these uses. The ZPU is open-sourced.

Some projects need code that must be small, but run on a CPU that inherently has larger code. Alternatively, a project may benefit from the wide selection of code, compilers and debugging tools for the GNU Compiler Collection. In these cases, an emulator can be written to implement the ZPU's instruction set on the target CPU, and the ZPU's compilers can be used to produce the code. The resulting system is slow, but packs code into less memory than many CPUs and enables the project to use a wide variety of compilers and code. [2]

Design features

The ZPU was designed explicitly to minimize the amount of electronic logic. It has a minimal instruction set, yet can be encoded for the GNU Compiler Collection. It also minimizes the number of registers that must be in the FPGA, minimizing the number of flip-flops. Instead of registers, intermediate results are kept on the stack, in memory. [1]

It also has small code, saving on memory. Stack machine instructions do not need to contain register IDs, so the ZPU's code is smaller than other RISC CPUs, said to need only about 80% of the space of ARM Holdings Thumb2. [1] For example, the signed immediate helps the ZPU store a 32-bit value in at most 5 bytes of instruction space, and as little as one. Most RISC CPUs require at least eight bytes.

Finally, about 2/3 of its instructions can be emulated by firmware implemented using the other 1/3 "required" instructions. Although the result is very slow, the resulting CPU can require as little as 446 lookup-tables (a measure of FPGA complexity, roughly equivalent to 1700 electronic logic gates).

The ZPU has a reset vector, consisting of 32-bytes of code space starting at location zero. It also has a single edge-sensitive interrupt, with a vector consisting of 32 bytes of code space beginning at address 32. Vectors 2 through 63 each have 32 bytes of space, but are reserved for code to emulate instructions 33 through 63.

The base ZPU has a 32-bit data path. The ZPU also has a variant with a 16-bit-wide data path, to save even more logic.

Tools and resources

The ZPU has a well-tested port of the GNU Compiler Collection. [1] Enthusiasts and firmware engineers have ported ECos, [1] FreeRTOS [3] and μClinux. [4] At least one group of enthusiasts have copied the popular development environment of the Arduino and adapted it to the ZPU. [5]

There are now multiple models of the ZPU core. Besides the original Zylin cores, [1] there are also the ZPUino cores, [5] and the ZPUFlex core. [6] The Zylin core is designed for a minimal FPGA footprint, and includes a 16-bit version. The ZPUino has practical improvements for speed, can replace emulated instructions with hardware, and is embedded in a system-on-chip framework. The ZPUFlex is designed to use external memory blocks and can replace emulated instructions with hardware.

Academic projects include power efficiency studies and improvements, [7] and reliability studies. [8]

To improve speed, most implementors have implemented the emulated instructions, and added a stack cache. [5] [6] [7] Beyond this, one implementor said that a two-stack architecture would permit pipelining (i.e. improving speed to one instruction per clock cycle), but this might also require compiler changes. [7]

One implementor reduced power usage by 46% with a stack cache and automated insertion of clock gating. [7] The power usage was then roughly equivalent to the small open-source Amber core, which implements the ARM v2a architecture.

The parts of the ZPU that would be most aided by fault-tolerance are the address bus, stack pointer and program counter. [8]

Instruction set

"TOS" is an abbreviation of the "Top Of Stack." "NOS" is an abbreviation of the "Next to the top Of Stack."

Required ZPU Instruction Set
NameBinaryDescription
BREAKPOINT00000000Halt the CPU and/or jump to the debugger.
IM_x1xxxxxxxPush or append a signed 7-bit immediate to the TOS.
STORESP_x010xxxxxPop the TOS and store it into the stack at an offset from the top.
LOADSP_x011xxxxxFetch from a value indexed in the stack and push it into the TOS.
EMULATE_x001xxxxxEmulate an instruction with code at vector x.
ADDSP_x0001xxxxFetch from a value indexed in the stack and add the value to the TOS.
POPPC00000100Pop an address from the TOS and store it to the PC.
LOAD00001000Pop an address and push the loaded memory value to the TOS.
STORE00001100Store the NOS into the memory pointed-to by the TOS. Pop both.
PUSHSP00000010Push the current SP into the TOS.
POPSP00001101Pop the TOS and store it to the SP.
ADD00000101Integer addition of TOS and NOS.
AND00000110Bitwise AND of the TOS and NOS.
OR00000111Bitwise OR of the TOS and NOS.
NOT00001001Bitwise NOT of the TOS.
FLIP00001010Reverse the bit order of the TOS.
NOP00001011No-Operation. (Usually used for delay loops or tables of code.)

Code points 33 to 63 may be emulated by code in vectors 2 through 32: LOADH and STOREH (16-bit memory access), LESSTHAN (comparisons set 1 for true, 0 for false), LESSTHANOREQUAL, ULESSTHAN, ULESSTHANOREQUAL, SWAP (TOS with NOS), MULT, LSHIFTRIGHT, ASHIFTLEFT, ASHIFTRIGHT, CALL, EQ, NEQ, NEG, SUB, XOR, LOADB and STOREB (8-bit memory access), DIV, MOD, EQBRANCH, NEQBRANCH, POPPCREL, CONFIG, PUSHPC, SYSCALL, PUSHSPADD, HALFMULT, CALLPCREL

Related Research Articles

Processor design is a subfield of computer science and computer engineering (fabrication) that deals with creating a processor, a key component of computer hardware.

In processor design, microcode serves as an intermediary layer situated between the central processing unit (CPU) hardware and the programmer-visible instruction set architecture of a computer, also known as its machine code. It consists of a set of hardware-level instructions that implement the higher-level machine code instructions or control internal finite-state machine sequencing in many digital processing components. While microcode is utilized in general-purpose CPUs in contemporary desktops, it also functions as a fallback path for scenarios that the faster hardwired control unit is unable to manage.

<span class="mw-page-title-main">Motorola 68000</span> Microprocessor

The Motorola 68000 is a 16/32-bit complex instruction set computer (CISC) microprocessor, introduced in 1979 by Motorola Semiconductor Products Sector.

<span class="mw-page-title-main">Motorola 6809</span> 8-bit microprocessor

The Motorola 6809 ("sixty-eight-oh-nine") is an 8-bit microprocessor with some 16-bit features. It was designed by Motorola's Terry Ritter and Joel Boney and introduced in 1978. Although source compatible with the earlier Motorola 6800, the 6809 offered significant improvements over it and 8-bit contemporaries like the MOS Technology 6502, including a hardware multiplication instruction, 16-bit arithmetic, system and user stack registers allowing re-entrant code, improved interrupts, position-independent code, and an orthogonal instruction set architecture with a comprehensive set of addressing modes.

x86 Family of instruction set architectures

x86 is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel based on the 8086 microprocessor and its 8-bit-external-bus variant, the 8088. The 8086 was introduced in 1978 as a fully 16-bit extension of 8-bit Intel's 8080 microprocessor, with memory segmentation as a solution for addressing more memory than can be covered by a plain 16-bit address. The term "x86" came into being because the names of several successors to Intel's 8086 processor end in "86", including the 80186, 80286, 80386 and 80486. Colloquially, their names were "186", "286", "386" and "486".

In computer science, an instruction set architecture (ISA) is an abstract model that generally defines how software controls the CPU in a computer or a family of computers. A device or program that executes instructions described by that ISA, such as a central processing unit (CPU), is called an implementation of that ISA.

<span class="mw-page-title-main">Transputer</span> Series of pioneering microprocessors from the 1980s

The transputer is a series of pioneering microprocessors from the 1980s, intended for parallel computing. To support this, each transputer had its own integrated memory and serial communication links to exchange data with other transputers. They were designed and produced by Inmos, a semiconductor company based in Bristol, United Kingdom.

<span class="mw-page-title-main">PIC microcontrollers</span> Line of single-chip microprocessors from Microchip Technology

PIC is a family of microcontrollers made by Microchip Technology, derived from the PIC1640 originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to Peripheral Interface Controller, and is currently expanded as Programmable Intelligent Computer. The first parts of the family were available in 1976; by 2013 the company had shipped more than twelve billion individual parts, used in a wide variety of embedded systems.

OpenRISC is a project to develop a series of open-source hardware based central processing units (CPUs) on established reduced instruction set computer (RISC) principles. It includes an instruction set architecture (ISA) using an open-source license. It is the original flagship project of the OpenCores community.

The MicroBlaze is a soft microprocessor core designed for Xilinx field-programmable gate arrays (FPGA). As a soft-core processor, MicroBlaze is implemented entirely in the general-purpose memory and logic fabric of Xilinx FPGAs.

<span class="mw-page-title-main">WDC 65C02</span> CMOS microprocessor in the 6502 family

The Western Design Center (WDC) 65C02 microprocessor is an enhanced CMOS version of the popular nMOS-based 8-bit MOS Technology 6502. It uses less power than the original 6502, fixes several problems, and adds new instructions. The power usage is on the order of 10 to 20 times less than the original 6502 running at the same speed; its reduced power consumption has made it useful in portable computer roles and industrial microcontroller systems. The 65C02 has also been used in some home computers, as well as in embedded applications, including medical-grade implanted devices.

PicoBlaze is the designation of a series of three free soft processor cores from Xilinx for use in their FPGA and CPLD products. They are based on an 8-bit RISC architecture and can reach speeds up to 100 MIPS on the Virtex 4 FPGA's family. The processors have an 8-bit address and data port for access to a wide range of peripherals. The license of the cores allows their free use, albeit only on Xilinx devices, and they come with development tools. Third-party tools are available from Mediatronix and others. Also PacoBlaze, a behavioral and device independent implementation of the cores exists and is released under the BSD License. The PauloBlaze is an open source VHDL implementation under the Apache License.

V850 is a 32-bit RISC CPU architecture produced by Renesas Electronics for embedded microcontrollers. It was designed by NEC as a replacement for their earlier NEC V60 family, and was introduced shortly before NEC sold their designs to Renesas in the early 1990s. It has continued to be developed by Renesas as of 2018.

<span class="mw-page-title-main">Parallax Propeller</span> Multi-core microcontroller

The Parallax P8X32A Propeller is a multi-core processor parallel computer architecture microcontroller chip with eight 32-bit reduced instruction set computer (RISC) central processing unit (CPU) cores. Introduced in 2006, it is designed and sold by Parallax, Inc.

<span class="mw-page-title-main">History of general-purpose CPUs</span>

The history of general-purpose CPUs is a continuation of the earlier history of computing hardware.

LatticeMico32 is a 32-bit microprocessor reduced instruction set computer (RISC) soft core from Lattice Semiconductor optimized for field-programmable gate arrays (FPGAs). It uses a Harvard architecture, which means the instruction and data buses are separate. Bus arbitration logic can be used to combine the two buses, if desired.

Advanced Vector Extensions are SIMD extensions to the x86 instruction set architecture for microprocessors from Intel and Advanced Micro Devices (AMD). They were proposed by Intel in March 2008 and first supported by Intel with the Sandy Bridge microarchitecture shipping in Q1 2011 and later by AMD with the Bulldozer microarchitecture shipping in Q4 2011. AVX provides new features, new instructions, and a new coding scheme.

AVX-512 are 512-bit extensions to the 256-bit Advanced Vector Extensions SIMD instructions for x86 instruction set architecture (ISA) proposed by Intel in July 2013, and first implemented in the 2016 Intel Xeon Phi x200, and then later in a number of AMD and other Intel CPUs. AVX-512 consists of multiple extensions that may be implemented independently. This policy is a departure from the historical requirement of implementing the entire instruction block. Only the core extension AVX-512F is required by all AVX-512 implementations.

RISC-V is an open standard instruction set architecture (ISA) based on established reduced instruction set computer (RISC) principles. Unlike most other ISA designs, RISC-V is provided under royalty-free open-source licenses. Many companies are offering or have announced RISC-V hardware; open source operating systems with RISC-V support are available, and the instruction set is supported in several popular software toolchains.

<span class="mw-page-title-main">COP400</span> 4-bit microcontroller family

The COP400 or COP II is a 4-bit microcontroller family introduced in 1977 by National Semiconductor as a follow-on product to their original PMOS COP microcontroller. COP400 family members are complete microcomputers containing internal timing, logic, ROM, RAM, and I/O necessary to implement dedicated controllers. Some COP400 devices were second-sourced by Western Digital as the WD4200 family. In the Soviet Union several COP400 microcontrollers were manufactured as the 1820 series.

References

  1. 1 2 3 4 5 6 7 8 "ZPU - the worlds [sic] smallest 32-bit CPU with GCC toolchain : Overview". opencores.org, Zylin Corp. Retrieved 7 February 2015.
  2. "ZOG - A ZPU processor core for Propeller with GNU C + Fortran". Parallax Forum. Parallax. Retrieved 6 September 2019.
  3. Antonio, Anton. "ZPUino-HDL/zpu/sw/freertos/". GitHub. Antonio Anton. Retrieved 7 February 2015.
  4. Lopes, Alvaro. "alvieboy/Linux". GitHub. Alvaro Lopes. Retrieved 7 February 2015.
  5. 1 2 3 Lopes, Alvaro. "ZPUino". www.alvie.com. Retrieved 7 February 2015.
  6. 1 2 AMR. "ZPU Flex". Retro Ramblings. Retrieved 9 February 2015.
  7. 1 2 3 4 Eriksen, Stein Ove. "Low Power microcontroller core". NTNU Open. Norges teknisk-naturvitenskapelige universitet. Retrieved 9 February 2015.
  8. 1 2 Zandrahimi, M. (2010). "An analysis of fault effects and propagations in ZPU: The world's smallest 32 bit CPU". 2nd Asia Symposium on Quality Electronic Design (ASQED). IEEE. pp. 308–313. doi:10.1109/ASQED.2010.5548320. ISBN   978-1-4244-7809-5. S2CID   20045721.