> Rabbit Microprocessor
> Frequently Asked Questions (FAQ)

> 20 September 1999

> Q. Why did you choose the name "Rabbit" for a microprocessor?

> A. Rabbits are fast and agile, and so is our microprocessor.

> Q. What's different about the Rabbit compared to other microprocessors such as the Z80, Z180, 8051, V25, etc.?

> A. The Rabbit was designed by people with extensive practical experience in designing small single-board computers and all the software that goes along with that business. The Rabbit is similar to the Z80 and Z180/HD64180 microprocessors, but it runs a lot faster and extensions to its instruction set make it much more C friendly. The software support for the Rabbit is extensive and easy to use. Our partner company, Z- World, Inc., has ported its Dynamic C interactive development environment to the Rabbit, and is currently designing a family of single-board control computers based on the Rabbit. The Rabbit is very fast for a processor with an 8-bit bus. It can handle large programs written in C. It has extensive on-chip peripherals, including four serial ports. The hardware design of a Rabbit system is exceptionally simple because of the glueless interface architecture of the Rabbit.

> In a nutshell, compared to previous generation microprocessors with an 8-bit bus, the Rabbit gives you easier hardware and software development and higher performance.

> Q. How does the Rabbit's performance compare to a Z80 or Z180?

> A. For comparable practical systems executing C language code, the Rabbit is about 4x faster than the Z80 and 3x faster than the Z180. A practical system is a system with a low-cost flash memory for code and a low-power static RAM for data. The Rabbit's software floating point is very fast, about 12 µs to add or multiply. An integer 16 x 16 multiply requires about 0.5 µs.

> Q. The Z180 is available with clock speed of 33 MHz while the Rabbit has a maximum clock speed of 30 MHz. How can the Rabbit be three times faster?

> A. The Z180 will run at 33 MHz, but at this speed a memory access time of at least 41 ns is required. This is faster than can be obtained with flash memory, so it would be necessary to copy the program from flash memory to a fast and expensive RAM in order to achieve this clock speed. The maximum clock speeds are shown below for the Z180 and Rabbit for various flash memory access speeds at standard baud rates.

> Memory Access Time (ns) | Maximum Rabbit Clock Speed (MHz) | Maximum Z180 Clock Speed (MHz)
> 55 | 29.4912 | 24.576
> 70 | 24.576 | 18.432
> 90 | 18.432 | 12.288

> The Rabbit runs at a clock speed that is approximately 30% faster than the Z180 for similar memory configurations. The Rabbit has an additional speed advantage because its instruction read cycle is 2 clocks long, while the Z180's is either 3 or 4 clocks. This gives the Rabbit an additional execution speed advantage of approximately 70%. The Rabbit gains an additional 35% in speed because it needs very few extra clocks beyond the minimum needed to read the instructions and data, and because it has new instructions that accelerate typical C compiler genera ted code. New instructions especially help in the manipulation of 16-bit quantities. These factors of 30%, 70% and 35% together amount to a 3 times speedup (1.3*1.7*1.35 = 2.98).

> Q. What are some important new instructions on the Rabbit?

> A. Instructions to fetch and store 16-bit variables at a computed address are very important for C, which favors the use of 16-bit integers. The Rabbit has very efficient instructions to fetch and store variables relative to hl, ix or iy index registers. New instructions facilitate use of the alternate registers. New math and shift instructions improve arithmetic. Examples are shown below.

> ld hl,(ix+d) ; loads 16 bits at ix plus 8 bit offset(+127, -128) d.
> ; requires 2 bytes, 9 clocks to execute.
> ld hl,(iy+d) ; 3 bytes, 11 clocks
> ld hl,(hl+d) ; 3 bytes, 11 clocks
> ld (ix+d),hl ; 2 bytes, 11 clocks
> ld (iy+d),hl ; 3 bytes, 13 clocks
> ld hl,(sp+n) ; load 16 bits from sp plus offset n 0-255 bytes.
> ; requires 2 bytes, 9 clocks
> ld (sp+d),hl ; 2 bytes, 11 clocks

> mul ; signed multiply hl:bc=de*bc. 1-byte, 12 clocks

> bool hl ; if hl==0 unchanged, else hl set to 1, 1 byte 2 clocks

> ex de',hl ; exchange hl and alternate de, 1 byte 2 clocks
> ex de,hl' ; 2 bytes, 4 clocks
> ex de',hl' ; 2 bytes, 4 clocks
> ld

> ld ix,hl ; 2 bytes, 4 clocks
> ld hl,ix
> ld iy,hl
> ld hl,iy
> ld dd',BC ; 2 bytes, 4 clocks, dd'= hl', de', or bc'
> ld dd',De
> ; 16-bit shifts

> ror de ; 1 byte 2 clocks
> rol de ; 1 byte 2 clocks
> ror hl ; 1 byte, 2 clocks

> The above list is not exhaustive.

> Q. Give some examples of how the Rabbit's new instructions speed up operations.

> A. C code often needs to manipulate 16-bit quantities. Often the memory address is computed relative to the system stack or relative to a pointer. The Rabbit has instruction extensions that make these important C operations execute faster. The table below gives some examples.

> Operation | Rabbit Code | Z180 Code
> Fetch 16-bit operand at stack plus offset | ld hl,(sp+offset) ; 9 clocks ; total 2 bytes, 9 clocks | ld hl,offset ; 9 add hl,sp ; 7 ld a,(hl) ; 6 inc hl ;4 ld h,(hl) ;6 ld l,a ; 4 ; total 9 bytes, 36clocks
> Store an integer at a location specified by a pointer to a structure passed as an argument. p->q=x; | ld hl,(x) ; 11 ld ix,(sp+p) ; 11 pointer ld (ix+q),hl ;13 ; total 7 bytes, 34 clocks | ld hl,p ; 9 add hl,sp ; 7 ld a,(hl) ; 6 inc hl ;4 ld h,(hl) ;6 ld l,a ; 4 ex de,hl ;3 ld hl,q ;9 add hl,de ; 7 pointer p->q ld de,(x) ; 18 ld (hl),e ;6 inc hl ;4 ld (hl),d ;6 ;total 19 bytes, 87 clocks
> Compute the logical value of an integer, start with the integer in hl. Value is zero if integer is zero, else value is 1. | bool hl ; 1 byte, 2 clocks | ld a,h ;4 or l ;4 jr z, xx ; 6/8 ld hl,1 ; 9 xx: 7 bytes, 25 clocks

> Q. Can I port existing Z80 or Z180 assembly code to the Rabbit?

> A. Yes. Some Z80 and Z180 instructions have been eliminated, but they are mainly obscure instructions or instructions that can easily be emulated by a short sequence of instructions. The instructions that deal with I/O devices are quite different, but usually I/O code cannot be ported from one system to another in any case, so nothing is lost.

> Q. How do input/output instructions work on the Rabbit?

> A. The Z80 and Z180 have special instructions (out, in) to perform I/O. Most Rabbit memory access instructions can be used to perform I/O by prefixing them with one of two prefixes. I/O to internal, on-chip, registers is indicated by the internal I/O prefix (ioi in assembly code). I/O to external devices uses an external I/O prefix (ioe in assembly code). This scheme makes I/O instructions more powerful and flexible. In addition, 16-bit I/O can be performed with a single instruction. In this case, two 8-bit I/O cycles take place during the single instruction, accessing the low byte and then the high byte of the 16-bit word.

> Q. Why didn't you keep strict compatibility with the Z80 and Z180?

> A. In order to get the best performance, we needed some single-byte op codes. Unfortunately there are very few (technically none) unused single-byte op codes. The minimum execution time for a single-byte op code is 2 clocks. A 2-byte op code requires at least 4 clocks, or twice as long. On the other hand, we noticed that many single- byte op codes on the Z80/180 are used up by unimportant, in some cases practically useless, instructions.

> The instructions that were dropped either fall into the useless class or into a class of instructions that are not worthy of their single-byte op codes because they are not used very much and can easily be emulated by substituting a few other instructions.

> The real reason why other Z80/Z180 compatible microprocessor manufacturers keep strict compatibility is that they are dependent on existing development tools provided by third parties that are not easily changed. Rabbit Semiconductor has a close relationship with Z-World, Inc., as the sole supplier of development tools for the Rabbit. Z-World has ported its Dynamic C compiler to the Rabbit. This gives us the flexibility to gain the performance improvements that are only available if strict compatibility is sacrificed.

> Q. Why did you change the Z180 memory mapping unit?

> A. The Z180 MMU allows the 64K address space to be divided into three memory mapping zones. We increased this to four zones because multitasking programs need to have multiple stacks. By having a fourth mapping zone, one zone can be dedicated as a stack segment, allowing any number of stacks for different tasks.

> Q. How does the Rabbit execute programs larger than the 64K addressing space of the 16-bit addresses used in the instructions?

> A. Traditionally software that supports the Z180/HD64180 uses the memory mapping unit to create overlays using bank switching so that code can be expanded beyond the 64K limit. This scheme typically divides the available 64K space into three zones, root code, data and overlay segment. Calling a function that resides in an overlay requires calling a subroutine resident in the root that changes the mapping and calls the function. Typically this involves painful compromises and substantial overhead both in memory and execution time for each call. A typical scheme might use 6 bytes of root code space for each call and require about 150 clocks to execute a call to a banked routine on a Z180. In addition, the space reserved for banked routines must be large enough to hold the largest function that will be banked. Typically, available memory space tends to be squeezed since the bank may have to be 20K or 30K in size.

> The Rabbit has dedicated instructions called long calls, long returns and long jumps that implement bank switching in hardware. In addition, the Rabbit always uses an 8K bank no matter how large the function is. The bank is slid in 4K steps as the routine is executed, so any size function can be executed in the 8K bank. The call and return combined overhead is only 32 clocks, and no root code space has to be used for linkage. The result is that programs up to a megabyte execute almost as efficiently as programs contained entirely in the root code space. Most of the root becomes available for data space because banked code or extended code executes efficiently.

> Q. Can the Rabbit access data in the full 1-megabyte memory space?

> A. Yes. The Rabbit has instructions that directly use a 20-bit address to fetch and store data.

> Q. Why does the Rabbit have multiple interrupt priorities?

> A. The Z180 or Z80 has a single priority of interrupts plus the nonmaskable interrupt. The Rabbit has four levels of priority that the processor can operate at. There are three levels of priority associated with interrupts. This allows for super priority interrupts that can interrupt lower priority interrupts. This guarantees a fixed response time for at least one super priority interrupt, allowing very fast response to critical events. The interrupt priority of on-chip peripheral devices is programmable as it the priority of the external interrupt request pins.

> Q. What is cold boot and what are the advantages?

> A. When we say that the Rabbit can be cold booted, we mean that it can be started up and a program can be downloaded to it with no pre-existing program in its memory. The cold boot can take place via any of three communication ports--asynchronous serial port A, synchronous serial port A, or the 8-bit parallel slave port. The advantage of the cold-boot capability is that Rabbit systems can be built with blank flash memory soldered to the circuit board (rather than socketed) and that the system can be programmed or reprogrammed at any time.

> When developing software for a Rabbit system, the PC that hosts the development system can completely reprogram the target flash memory at any time. This is done over a serial link.

> The cold-boot startup mode is controlled by two processor pins that determine the startup mode of the microprocessor. If both pins are low, the processor starts in the normal mode by executing instructions starting at address zero. In the other three modes the processor expects commands to cold boot it over one of the three communication paths that support cold boot.

> Q. What is cloning and what is it used for?

> A. Rabbit software developed under Dynamic C supports cloning. Cloning means that the program can copy itself to another similar processor board. This is accomplished by connecting the standard programming ports on the two systems together with a simple cloning cable. Cloning is a simple substitute for a flash memory programmer. One board is programmed using Dynamic C and then its program can be quickly copied to any number of other boards in a few seconds per board.

> Q. Describe the on-chip serial ports.

> A. There are four serial ports. One of the serial ports is used for software development, and can also be shared by the user application. Of the four serial ports, two have synchronous capability and can drive many serially clocked peripheral devices, for example, A/D converters. All four serial ports can operate in asynchronous mode with 7 or 8 data bits and at very high baud rates (processor clock speed divided by 32). The "9th bit" scheme used in the Z180 and some other processors is also supported. The serial ports can be programmed to interrupt at a super priority level, making it possible to support the high data transfer rates.

> We put a large number of serial ports on the Rabbit because today many applications seem to "eat" serial ports. For applications needing more than four serial ports there are several options. The Rabbit can bit-bang a serial port using its parallel I/O and fast interrupt capability. Bit-banging is very practicable at 2400 bps and with care can go much faster. Another option is to use a slave Rabbit processor to provide an additional four serial ports. Using a slave Rabbit allows off-loading protocol handling to the slave Rabbit. (See the slave port below.)

> Q. Describe the slave port and how it can be used.

> A. The slave port can be used to make a Rabbit system act as a peripheral device to another, master, microprocessor system. The master may or may not be Rabbit-based. The Rabbit slave port allows the master to use a set and forget programming style, just as it would with a typical peripheral device such as a UART.

> To the master, the slave port appears as six I/O registers, three write registers and three read registers. The appearance is the same to the slave Rabbit, except that the master's write registers are the slave's read registers and vice-versa. A status register is read only and may be read by either the master or the slave.

> When any register is written to, a bit is set in the status register to show that the register is "full." When the other side reads the contents of the register, the bit is cleared to show that the register is "empty." In addition, the first register pair has the capability to cause an interrupt on the other side when written to. This setup allows a variety of different communications protocols, using interrupts or polling, and allows fast transfers of blocks of data. With the right protocol the master does not have to wait for the slave to respond to new information in the registers. The master can store a request and continue with its business.

> A minimal slave system requires only two chips, a Rabbit processor and a RAM memory chip. The program can be downloaded from the master to the RAM on the slave. Clocks can be supplied by the master.

> Q. Give some examples of typical applications for a Rabbit slave system.

> A. A slave Rabbit can be easily made into a four-channel intelligent UART. Since the slave not only has four serial ports, but is intelligent, a complete protocol can be off- loaded to the slave.

> An extension of this concept is to off-load a complex protocol such as TCP/IP to a slave system that might include an Ethernet interface. This is a prime Rabbit application that will have substantial software support in the future.

> A slave Rabbit can be used for motion control that demands the rapid and intelligent generation of precisely timed pulses. The ability to generate timer synchronized outputs on parallel ports D and E can be combined with the programmability of the slave to drive stepping motors or to control device speed using pulse width modulation.

> Q. Describe the on-chip parallel I/O.

> A. There are 40 parallel I/O lines grouped in five 8-bit ports designated A, B, C, D, and E. In addition, there are other miscellaneous pins that can be used for parallel I/O. Many of the pins have multiple personalities, so the use of some features will reduce the number of parallel I/O pins available. The 16 I/O pins in ports D and E have timer-synchronized outputs that can be programed to transition at a precisely specified time controlled by a timer unit. These outputs also have a high drive capability.

> Q. Describe the on-chip battery backable clock.

> A. The on-chip battery backable clock is a 48-bit counter that can be backed up by a battery when the main system power is off. The counter counts at 32.768 kHz. An on- chip crystal oscillator uses a 32.768 kHz crystal. The battery current required to operate the oscillator and clock is approximately 25 µA. For applications requiring lower power, an external oscillator is available, and it substantially reduces the total current consumption.

> Q. Describe the glueless memory interface.

> A. The normal code space accessible directly by call and jump instructions is 1M. The normal data space accessible directly by load and store instructions is 64K. However, memory can be expanded far beyond these limits for the purpose of storing auxiliary code or data. The Rabbit is designed to connect directly to static memory chips. This is the glueless memory interface. There are three memory chip select lines and two sets of write enable and output enable lines. There are 20 address lines corresponding to the 20-bit basic 1M address space. Eight bidirectional data lines complete the memory interface. Up to six static memory chips can be connected directly if pairs of chips share the same chip select. In addition, the memory address lines can be manipulated to allow each of the six chips to have 1M of memory, for a total of 6M. If more memory is needed, parallel ports can be used as high-order address lines to expand the memory to any desired degree.

> Embedded Processor Core Using Rabbit

> Q. How do you program a Rabbit-based system?

> A. Program debugging and program load is done via a standard 10-pin programming connector. The connector has two rows of five pins on a 2 mm spacing. The cost associated with this connector, including the cost of the PC board area taken for the connector, the connector hardware, and four resistors, is approximately 25 cents (US). A low-cost smart cable is used to connect an RS-232 port to the programming connector. The smart cable includes a level converter to match the RS-232 port signals to the logic levels on the Rabbit board. The Rabbit-based system can be programmed and debugged using a PC platform to host Z-World's Dynamic C interactive development environment. Dynamic C programs are compiled and downloaded via the programming port. Extensive source code debugging features are an integral part of the environment.

> Dynamic C Programming

> The programming port communicates with the Rabbit via on-chip serial port A. There are four serial ports designated A, B, C, and D. Since serial port A I/O can be switched to alternate pins via internal Rabbit control registers, it is possible to share the port between programming and a user application. The programming port can also be used to load programs in a production environment. A simple procedure allows the flash memory to be completely programmed via the programming port. Another use for the programming port is as a diagnostic or setup port for communicating with system software in the field.

> Q. Do I have to include the programming port in my system?

> A. You need it in when you are debugging software, but you can leave it off the finished product of you want. But the programming port is so inexpensive and has so many uses beyond debugging software that we suggest that you always include it.

> Q. Z-World offers a $49 small controller board called the Jackrabbit that is based on the Rabbit processor. How does the Jackrabbit compare with the $39 Stamp single board computer produced by Parallax, Inc.?

> A. Parallax's BASIC Stamp is a popular low-cost single-board computer used primarily by hobbyists to perform a variety of tasks, from robotics to rocketry. While the low cost and ease of use of the Stamp are appealing, the severe limitations in memory (2K of program, 32 bytes of data), speed (about 2000 statements per second), and I/O (16 digital I/O eventually cause engineers to look for a Stamp replacement. The JackRabbit is an excellent stamp replacement. While being physically larger than the BASIC Stamp, the JackRabbit is actually much smaller than a typical I/O board for the Stamp, which each customer is required to design and build on their own. Furthermore, the Jackrabbit's larger memory, faster execution, and real-world I/O make it suitable for serious applications that are well beyond the reach of the BASIC Stamp. A minimum configuration Jackrabbit has 1000 times as much data memory, 64 times as much program memory, 3 times as much digital I/O, and it executes programs about 500 times faster.

> Q. Describe the low-power "sleepy" mode of operation.

> A. Many microprocessors have a "sleep" mode. This is a mode of operation where the execution of instructions stops and the microprocessor waits for a transition on an input line or it waits for a timer to count down, at which point it resumes executing instructions. The Rabbit has a "sleepy" mode of operation. This simply means that it continues to execute instructions, but very slowly, at about 3,000 instructions per second. This is accomplished by driving the main processor clock from the 32.768 kHz oscillator. The main oscillator, which typically runs at multiple megahertz, is shut down. In sleepy mode the current consumption is reduced to a few hundred microamperes or less. The advantage of sleepy mode is that the microprocessor can come back to normal operation depending on far more complex conditions than are possible in a typical sleep mode implementation.

> Q. Describe the Rabbit's features that make it suited for low-power or battery-operated applications.

> A. The Rabbit can double its clock speed or divide it by 4 or by 8 under program control. In a properly designed system, the current consumption follows the clock speed. In addition, the clock can be changed to the 32.768 kHz oscillator. (See "Q. Describe the low-power "sleepy" mode of operation." on page 11.) This allows the power consumption to be throttled up or down depending on need for computation at a given time. For example, a portable instrument might operate in sleepy mode at 32.768 kHz until the operator presses a key. Then it might accelerate its operating speed to 3.68 MHz with a current consumption of 12 mA. Between operations it might slow down to 3.68 MHz divided by 8, or 0.46 MHz, reducing the current consumption to about 1.5 mA. After 5 min of inactivity, it might enter back into sleepy mode with a current consumption of 200 µA.

> The Rabbit can operate over a voltage range from 2.5 V to 5.5 V. In addition to changing clock speed memory wait states and be increased to further reduce current consumption. Certain identified instructions can be executed while a program is standing by waiting for an event to further reduce current consumption at a given clock speed.

> The Rabbit is normally operated at 3.3 V to minimize power consumption. (For maximum speed, 5 V is used.) At 3.3 V the slowest clock speed that will do the job is used. Often the clock will be throttled up and down as computational needs vary.

> Q. How is the Rabbit floating-point performance?

> A. The Rabbit uses software routines to perform floating add, subtract, and multiply, each in about 350 clocks, or in about 12 µs at the maximum clock speed. Floating divide and floating square root each take about 900 clocks or 30 µs at the maximum clock speed. This is much faster than other microprocessors in its class, including typical implementations of floating point on lower-end x86 processors.

> Rabbit Semiconductor
> 2932 Spafford St.
> Davis, CA 95616

> Telephone: 530 757 8400
> Fax: 530 757 8402

> http://www.rabbitsemiconductor.com

Rabbit Semiconductor http://www.rabbitsemiconductor.com Voice: (530) 757-8400 FAX: (530) 757-8402 sales@rabbitsemiconductor.com