VHDL Code Generator


This page allows you to interactively design an arithmetic & logic unit. The schematic module diagram below will adjust to reflect the settings as you choose them. When you have selected your chosen options, press the "Generate VHDL" button and the tool will produce VHDL code corresponding to the configured ALU. You are free to cut and paste this code into your own projects.

Schematic Diagram
Diagram should appear here if you have enabled Java.

Design Specification

Design your ALU by specifying the following parameters…


The ALU has two source operands, a & b. These correspond with internal a & b buses. You may select the source inputs to be registered (useful when multiplexing a and b on a common bus.)

bit(s) when shorter than "b".

bit(s) when shorter than "a".

The ALU can optionally incorporate a shift/rotate block in one of the input paths. A full multi-bit barrel shifter is an expensive resource in terms of gates/logic blocks, so the one implemented here is limited to single bit left and right logical and arithmetic (sign preserving) shifts and rotates. The shifter does not affect/incorporate the carry flag.


Add the desired operations, specifying the op. code and arithmetic or logical operation required. The ALU allows functions on one or two operands (a & b) and optionally a carry (borrow) in for arithmetic operations.

Action Op Code Binary Hex ALU Operation Shifter Operation

Delete selected op. codes Delete selected Add op. codes Add op. code(s) Sort by op. code Sort by op. code

The output of the ALU can be tristated with a bus enable signal (useful if output and input buses are common or multiplexed) and/or registered.

bit(s) wide.

Check the following boxes to implement the corresponding ALU output flag(s).

VHDL Source Code

The VHDL for your ALU will appear here when you press the Generate VHDL button…

Privacy statement: This website does not use cookies to track your use of the site.