LALU:
Lookup
Arithmetic Logic Unit
MTM
Scientific, Inc
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
back
into A.
Here are the assignments for the Accumulator "A", B Register "B" and
Output.
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.
Control Name
Description (Result always sent to
A)
0000 AND
Logical AND of A and B
0001
OR
Logical OR of A and B
0010
NOT Logical NOT of A
0011
INC Increment A
by 1
0100
DEC Decrement A
by 1
0101
RLS Right
Logical Shift
0110
ADD Addition
(A+B)
0111
SUB Subtraction
(A-B)
1000
A>B Set Flag
If A>B
1001
A=B Set Flag if
A=B
1010
A<B Set Flag
if A<B
1011
MBA Move B to A
1100
MUL Multiply
(A*B)
1101
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
spreadsheet
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
cells of
column C. The A and B columns are inputs to the calculation.
(Representing registers
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
worksheet).

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
creation.
Another real world shortcoming of the LALU is the speed of calcuation.
The M27C801
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.
http://39k.ca/using-roms-as-combinational-logic/
Here is a fantastic article from Garth Wilson on using ROM's for lookup
tables.
http://wilsonminesco.com/16bitMathTables/
Bitwise operations are not native to Excel 2007. Here is a description
of how to add them using Visual Basic.
https://stackpointer.io/software/bitwise-operations-excel-not-and-or-xor/281/