8051
8051 is a term for Intel's MCS-51 single chip microcontroller (MCU). It was one of the first microcontrollers ever. The instruction set is still in use in a lot of modern designs.
Speed
Speed depends very much on implementation. The original 8051 needed 12 clock cycles per machine cyle. Most instructions need 1 or 2 machine cycles, so that at 12MHz, 1 million single-cycle insgtructions or 500,000 two-cycle instructions can be executed. Modern implementations are usually "pipelined," and they execute a single instruction in a single cycle, so they are much faster than the original design.
Memory architecture
Internal RAM (IRAM)
Internal RAM can be adressed with an 8-bit architecture (@R0, @R1, or immediate-8), meaning that up to 256 bits of RAM is possible. Not a whole lot by today's standards. In addition to that, only the @R0 and @R1 address modes can actually access the entire IRAM. For direct access (address is the second byte of the instruction), only the lower half from 0x00 to 0x7F can be accessed. If bit 7 of an address is set, the SFRs are accessed instead.
Special fuction registers
The special function registers(SFRs) overlap the IRAM's address space. Direct accesses to the upper half (0x80-0xFF) access the SFRs instead of the IRAM. Indirect read or write operations (using @R0 or @R1) access IRAM.
XRAM
XRAM used to be called "external RAM". In most modern designs, the external RAM is also internal. CPU architecture determines reasons for having two types of internal RAM. IRAM is limited to 256 bits and cannot be expanded. At the same time, IRAM is also necessary, as it is used for stack. The solution for obtaining more RAM is use on-chip XRAM. XRAM can be adressed via the 16-bit DPTR, so a regular 8051 CPU can address up to 64 KB of XRAM.
Program Memory (PMEM)
Registers
The classic 8051 has the following registers:
- PC—16-bit program counter. Contains the address for the place it should readg the next instruction
- A—Accumulator. 8-bit register used by most instructions. Memory mapped to 0xE0
- B–8-bit registers are used as extension to A for multiply and divide. Memory mapped to 0xF0
- SP–8-bit stack pointer
- DP–Data pointer. 16-bit register used by instructions accessing PMEM and XRAM. Memory mapped to 0x82-83
- PSW-Program status word. 8-bit register that contains various flags
- R0-R7-4 banks of 8 8-bit general purpose registers. Memory mapped to 0x0-0x1f, where the first bank uses the first 8 B from 0..7. The selected bank is chosen by the 2 RSB bits in the PSW.
Instruction set
Programming
Currently, most 8051 devices are programmed in C or with an assembler. There are good compilers available for the architecture that allow optimization via keywords in order to define memory areas and types of pointers. It is next to impossible to write generic C-code for the 8051, since a pointer needs to be of a particular type that defines the memory area to access. If a pointer is untyped (generic), access is typically done in a subroutine, slowing down code execution significantly.
Debugging
On tradidional 8051 devices debugging was previously limited or impossible. The only option was to use a "bond-out chip" and in-circuit emulator.
Today's 8051-based microcontrollers typically have a debug interface. For some of these, such as Silabs EFM8 devices, SEGGER J-Link can and is often used: J-Link: https://www.segger.com/products/debug-probes/j-link/technology/cpus-and-devices/silabs-efm8-c8051-support/