Arithmetic Logic Unit
Figure 1: 8 MB EPROM with 20 Address Lines for use as LALU
This page describes the design and development of LALU: Lookup
Arithmetic Logic Unit. The LALU functions as the ALU for a simple
digital computer design in development. Traditionally an ALU is
included in the Central Processing Unit (CPU) of a computer. Stand
alone ALUs are also available, such as the venerable 74LS181. This page
describes using an 8 MB EPROM (M27C801: Organized as 1MB x 8 Bits) to
perform ALU functions on two 8-bit input registers "A" and "B".
The 8-bit output appears on IC pins Q7-Q0, which is then registered
Here are the assignments for the Accumulator "A", B Register "B" and
B Register Inputs: A7, A6, A5, A4, A3, A2, A1, A0 (LSB)
A Register Inputs: A15, A14, A13, A12, A11, A10, A9, A8 (LSB)
ALU Output: Q7, Q6, Q5, Q4, Q3, Q2, Q1, Q0 (LSB)
LALU Function Select Inputs: A19, A18, A17, A16 (LSB)
The function to be performed by the LALU is chosen by using a 4
bit wide control nibble. A surprising variety of functions can be
performed with this simple architecture. Here is our initial assignment
for 16 functions for LALU.
Description (Result always sent to
Logical AND of A and B
Logical OR of A and B
NOT Logical NOT of A
INC Increment A
DEC Decrement A
A>B Set Flag
A=B Set Flag if
A<B Set Flag
MBA Move B to A
LAZ Load A with Zero
The LALU output is always sent to Register A (The starting contents of
Register A are subsequently lost.) The contents of Register B are
preserved. The flag functions set a binary True/False output (1
or 0) which is sent to Register A. Overflows for addition,
subtraction and multiplication are indicated by sending "FF" to A.
(Errors must be checked programatically.)
The list of functions chosen here for the LALU is basic.
LALU functions could include trigonometric quantities (sine,
cosine, etc), coefficients for calculations (FFT, infinite series,
etc), other logical functions (NAND, XOR, etc) as well as other flags,
bit shifts, rotates and support for complement
math. (Presently we use unsigned integer math.)
Here is a link to the HEX file we have defined above. This file is
suitable for burning into an EPROM such as the M27C801: LALU.HEX
The HEX file for burning the EPROM is created using an Excel
and hex file editor. The Excel spreedsheet has 1,048,576 rows...
corresponding to the 1,048,576 memory locations in the EPROM.
Coincidentally, this was the largest number of rows possible in
a Microsoft Excel 2007 spreadsheet. The actual HEX file data appears in
column D. The
table is generated by using conditional logic formulas in the
column C. The A and B columns are inputs to the calculation.
A and B) The large size of the spreadsheet file makes it
difficult to navigate. Hyperlink shortcuts were added to facilitate
navigation (See the hot links on the far righthand side of the
Figure 2: Excel Hex File composer for the LALU
A shortcoming of this LALU implementation is the
8-bit nature of register inputs A and B, as well as the output
result. A desirable feature for the LALU would be operation as a
bit-slice component. For example, in the case of
addition this would require routing an overflow signal to the next LALU
bit slice. Unfortunately, this would require dedicating a control line
address for the purpose. Consequently, the 4 address lines would be
reduced to 3, and instead of 16 functions the LALU would have
8. Larger programmable ROM's are available, although they present
challenges in terms of cost, programming hardware and hex file
Another real world shortcoming of the LALU is the speed of calcuation.
chosen here has an access time of 45ns. Many EPROMs have slower access
times. Another shortcoming is that a single-cell entry
mistake in the 1 million plus Excel spreadsheet would be
difficult to detect in practice.
Here are some interesting links to similar projects and discourse:
Here is an article about using ROM's for combinational logic.
Here is a fantastic article from Garth Wilson on using ROM's for lookup
Bitwise operations are not native to Excel 2007. Here is a description
of how to add them using Visual Basic.