Readings
- Addition:
- IMAL: Section 1.6.1, 1.6.2
- N2T: Section 2.1 (slides 14-33)
- Adders:
- N2T: Chapter 1 (all slides)
- N2T: Section 2.2.1, 2.3, 2.5 (slides 60-64, 66-end)
Description
This assignment will focus on creating digital circuits. The main tasks are:
- building and testing NWay plexers
- building and testing circuits for addition
Build the circuits described in Project 2 (except
ALU
, but including
Mux4Way16, Mux8Way16, DMux4Way, DMux8Way
from Project 1):
N2T: Project 2
Chapter 2 provides the contract for each circuit, i.e. description of its behavior, names and number inputs, names and state of outputs.
Design in Logisim
Note the following requirements:
- create empty folder
cs221/02/
and save the Logisim files there
- arrange the circuits one after the other in the given order
- label the input pins as specified in the contract
- the topmost output pin of each circuit should include its given name and the name of the circuit:
for example, for And16 the topmost pin will be named out_And16
Here are additional specific requirements:
Splitter
: Logisim has a component called Splitter
under Wiring
; it actually can be used to split or merge wires depending on the point of view (i.e. on the orientation); it can be oriented appropriately via the Properties
panel
Constants
: to achieve the effect of sending the constant value 1 to a pin in Logisim use the component 1⚬Constant
under Wiring
; it can be followed by Not
if the constant 0 is needed
Mux4Way16, Mux8Way16
:
- save in file named MuxNWay16.circ
Mux4Way16
should be built primarily of Mux16
, i.e. only 2 inputs of width 16, and selector of width 1; basic/basic16 gates should be avoided if possible
Mux8Way16
should be built primarily of Mux16, Mux4Way16
, i.e. only 2 or 4 inputs of width 16, and selector of width 1 or 2; basic/basic16 gates should be avoided if possible
- Logisim has a single Multiplexer component whose properties can be changed to have the desired number of inputs and bus widths
- in each case the selector of the circuit under construction should be a single input component that is split immediately into the appropriate number of lines/widths (use Splitter under Wiring)
DMux4Way, DMux8Way
:
- save in file named DMuxNWay.circ
DMux4Way
should be built primarily of DMux
, i.e. only 2 outputs of width 1, and selector of width 1; basic/basic16 gates should be avoided if possible
DMux8Way
should be built primarily of DMux, DMux4Way
, i.e. only 2 or 4 outputs of width 1, and selector of width 1 or 2; basic/basic16 gates should be avoided if possible
- Logisim has a single Demultiplexer component whose properties can be changed to have the desired number of outputs and bus widths
- in each case the selector of the circuit under construction should be a single input component that is split immediately into the appropriate number of lines/widths (use Splitter under Wiring)
HalfAdder, FullAdder
:
- save in file named HalfFullAdder.circ
- only basic gates allowed
Add16
:
- save in file named Add16.circ
- despite the name, for the Logisim version the two inputs will be of width 6, i.e. the Adder will only add 6 bit numbers
- the circuit should be built of
Adder
components (under Arithmetic); the wires of these components should have width 1
- the circuit should have only two input components of width 6 (one each for
a, b
) that are immediately split into individual wires (use Splitter under Wiring)
- the circuit should use a single output component of width 6 that merges the individual internal output wires (use Splitter under Wiring, oriented appropriately)
- basic gates may be used if useful
Inc16
:
- save in file named Inc16.circ
- despite the name, for the Logisim version the inputs will be of width 6, i.e. the circuit will only increment 6 bit numbers
- option 1: ok to build with suitably sized
Adder
- option 2: ok to build of
Adder
components (under Arithmetic); the wires of these components should have width 1
- the circuit should have a single input component of width 6 that is immediately split into individual wires (use Splitter under Wiring)
- the circuit should use a single output component of width 6 that merges the individual internal output wires (use Splitter under Wiring, but oriented appropriately)
- see above how to set a pin to a constant value
- basic gates may be used if useful
Design in HDL
Note the following additional requirements:
- in folder cs221/02/ copy one at a time the starter code for the required circuits
- copy to folder cs221/02/ the following files:
Mux4Way16.(hdl|tst|cmp), Mux8Way16.(hdl|tst|cmp)
DMux4Way.(hdl|tst|cmp), DMux8Way.(hdl|tst|cmp)
- do not copy any of the
Mux/DMux
files that were built in Project 1
- if there is an empty or incorrect circuit in the current folder it will affect other circuits that depend on it
Here are additional specific requirements:
Splitter
: to achieve the effect of splitting wires in HDL you write gatepin=wire[i..j]
or gatepin[i..j]=wire
(the widths have to match)
more generally, you can write gatepin[i..j]=wire[p..q]
(the widths have to match), but this general version will not be needed for this assignment
gatepin
could be an input or output pin of the gate
Constants
: to achieve the effect of sending the constant values 1 or 0 to a pin in HDL you write gatepin=true
or gatepin=false
(should work regardless of pin width)
Mux4Way16, Mux8Way16
:
Mux4Way16
should be built primarily of Mux16
, i.e. only 2 inputs of width 16, and selector of width 1; basic/basic16 gates may be used if useful
Mux8Way16
should be built primarily of Mux4Way16
, i.e. only 4 inputs of width 16, and selector of width 2; basic/basic16 gates may be used if useful
DMux4Way, DMux8Way
:
DMux4Way
should be built primarily of DMux
, i.e. only 2 outputs of width 1, and selector of width 1; basic/basic16 gates may be used if useful
DMux8Way
should be built primarily of DMux4Way
, i.e. only 4 outputs of width 1, and selector of width 2; basic/basic16 gates may be used if useful
HalfAdder, FullAdder
: only basic gates may be used
Add16
: built primarily out of HalfAdder, FullAdder
; basic gates may be used if useful
Inc16
:
- option 1: ok to build with
Adder16
- option 2: ok to build primarily out of
HalfAdder, FullAdder
; basic gates may be used if useful
- see above how to set a pin to a constant value
Modify and test the respective
.hdl
files given by the authors that you copied from
projects/02/ to
cs221/02/:
- Win users: could use Notepad (shows line numbers at bottom right)
- Mac users: could use TextEdit, ensure file is edited and saved in Plain Text: "Format Menu:Make Plain Text"