By Val Gretchev, Electro-Tech-Online member
Many students in Electrical Engineering learn how to use and program a microprocessor but very few know what goes on inside. This article will give the reader insight into the inner workings of a very simple microprocessor that can be extended to more powerful designs. I will use a visual method of ANDs, ORs, and Inverters to implement the data paths and controls. In order to do that, we have to use a logic simulator to test the design. Fortunately, there is a simple free program (CEDAR Logic) that accomplishes this task and is easy to learn. You can download the CEDAR Logic Simulator here.
Before integrated microprocessors, there was a wonderful chip with a number designation of 74181 (a 4-bit ALU). This was a time when you made up a microprocessor using many TTL logic chips. Two or four of these ALU chips made the core of a microprocessor. For a 16-bit ALU, there was a companion chip designated 74182 which was used to speed up the carry output. These chips are no longer readily available but the published circuit diagram makes it useful for simulation. You can view datasheets here: DM74LS181 REFERENCE_MANUAL-HCS08, SN74LS182, SN74LS182DM74LS181.
The block diagram below shows the data paths that feed the ALU and RAM.
There is only 1 Accumulator for simplicity. Control logic is centered on a 32-bit ROM that implements the sequences for fetching data from RAM and decoding the instructions. You can view the sequences as a state diagram but traditionally it’s called horizontal programming as shown here.
Each program word is 32 bits wide and includes the next address of the flow. Two way branching is possible on the Carry Latch, Zero Latch and bit 0 of the Op Code Register. A 16 way branch can be performed on the high-order 4 bits of the Op Code Register.
As mentioned before, the Arithmetic-Logic-Unit is based on the 74181 datasheet. Refer to image below of the circuit as presented by the simulator.
This shows the data paths feeding the A-side of the ALU…
…and this shows the B-side data path for the ALU:
And the sequencer and clock and displays complete the entire design.
Description (includes Instruction Sets)
The post Designing a Microprocessor from Scratch appeared first on Micro Controller Tips.
Filed Under: TECHNOLOGIES + PRODUCTS