Part 1: General DescriptionThe Heritage-1 is a home-made minicomputer designed to host a multi-user/multitasking Operating System yet to be either developed or ported from existing source code.
The machine can be operated in three possible modes: Step, Real and Protected. When not in Protected mode, all support for General Protection gets disabled thus low level code can be loaded and executed from anywhere in memory.
Main Features
Data Bus : 16 bits
Address Bus : 20 bits (addresses point to 16 bit words)
Main Memory : SRAM 1 Mw (2 MB) max.
Arithmetic : Signed integer (two's complement)
Operating Modes : Step, Real, Protected
Virtual Memory : Paging with Pages Tables separate from Main Memory.
Page Frame size : 1Kw (2 KB)
Multitasking : Hardware support for up to 64 processes
running in separate time-slices.
Peripherals : Memory mapped
Interrupts : Vectored 256 max.
Nested ISR : Yes, based on priority
DMA : Yes
Clock Speed : No specified
Technology : No specified
Memory Organization
Main Memory is wired for 16 bits data path. Addressing one byte separately is not possible in the Heritage-1.
When reading larger numbers (such as a 32 bits Long), the least significant word comes first, that is the smaller address corresponds to the least significant word composing the number.
Memory chips (either RAM or ROM) can be distributed in any manner within the addressable space, except for the following:
- The very first block of 512 words (00000-001ff) must be populated since interrupt vectors are pointing there. It is recommended to populate the entire 1 Kw page frame (00000-003ff).
- Not the entire (1Mw) addressable space can be filled with physical memory because peripherals are memory mapped. It is recommended to preserve 1Kw (the size of a page frame) for peripheral addresses, aligned respect to all other page frames.
Registers
Registers in the Heritage-1 CPU can be classified into three categories:
- General Purpose
- Address Oriented
- CPU specific
General Purpose registers are 16 bits and they are accessible to the applications programmer. The Accumulator (A) serves as left operand and result holder for the ALU.
Address Oriented registers are 20 bits and they serve as pointers to Main Memory or Peripherals.
CPU specific registers have different sizes and they are not directly addressable. Falling into this category are the Program Counter (CP) and the Instruction Register (IR).
Addressing Modes
This specification does not limit implementation of different addressing modes in the Heritage-1. However, it establishes the minimum to be provided. Those are the following:
Addressing Mode Example (pseudo assembler)
---------------------------------------------------------
Reg Immediate movi A, value
Reg Direct mov A, B
Mem Direct movd A, addr
Mem Indirect Indexed movx A, Y
Since peripherals are memory mapped, all memory addressing modes apply to peripherals as well.
Arithmetic and Logic Unit (ALU)
The ALU is designed so it can be enhanced with reasonable easy. The initial ALU must provide the following operations:
Note: All these operations apply to 16 bits signed (two's complement) integers.
ADD Add
DEC Decrement
CMP Logical NOT (complement)
AND Logical AND
OR Logical OR
XOR Logical XOR
SHIFT Both Left and Right with and without Carry
Instruction Set Architecture (ISA)
The Instruction Decoder and Control circuit (IDC) must be designed so it can be enchenced to support new instructions to come in the future.
The minumum instruction set must provide support for the following:
- Data transfers
- ALU operations
- Switching between Real and Protected operating modes
- Access to Supervisor operations when in Protected Mode
- Software Interrupts
The Heritage-1 computer allows code to access Supervisor privileged instructions when the machine is in Protected Mode as long as such code resides in page frames marked as Supervisor.
Interrupts
Interrupts are organized into 256 vectors termed INT-00 through INT-FF. The first sixteen (INT-00 through INT-0F) are for CPU internal use; all others (INT-10 to INT-FF) are available to peripherals.
Interrupt vectors points to consecutive locations in the very first block of the addressable space. Each vector takes two consecutive addresses, thus INT-00 points to 0x00000, INT-01 points to 0x00002 and so on. INT-FF points to 0x001fe.
When interrupted, the CPU fetches the corresponding vectored address. What is expected to be there is a branch instruction to the actual ISR.
INT-00 is the computer's clock tic raised at 1 ms intervals. A multitasking operating system can make use of INT-0 to define processes time-slices among other uses.
INT-01 through INT-FF are used by the CPU to generate exceptions. Software code is allowed to raise interrupts within this range by using interrupt instructions.
All interrupts are maskable. Not masked interrupts can be served in a nested fashion according to interrupt priority.
Queuing interrupt requests is the job of the Operating System. The CPU limits itself to service interrupts in the simple way we just described.
Peripherals
Peripherals are memory mapped and they may use interrupts for requesting CPU attention as well as DMA for direct data transfer to or from Main Memory.
Both Interrupt and DMA subsystems are designed in such a way that a peripheral cannot monopolize the bus during a data transfer operation. This is achieved by making the Computer's Clock Tic the highest interrupt priority of all so the Operating System can preemptively schedule all other interrupt service routine's tasks as well as DMA operations.
|