Hydra Reference Manual

Bit Level Circuits

[Up to contents]

This section describes the circuits that operate on individual bits, including basic logic gates and basic building blocks. The name `a' is the bit signal type (for example, Bool).

Constant signal values

These constant values are defined for all signal types.
Component Type Description
zero a Constant signal 0
one a Constant signal 1

Logic gates

These components are defined for all signal types.
Component Type Description
buf a -> a Buffer: amplifies signal but doesn't change it
inv a -> a Inverter: logical negation of input
and2 a -> a -> a 2-input and gate
nand2 a -> a -> a 2-input not-and gate
or2 a -> a -> a 2-input inclusive or gate
nor2 a -> a -> a 2-input not-or gate
xor2 a -> a -> a 2-input exclusive or gate
xnor2 a -> a -> a negation of xor2
and3 a -> a -> a -> a 3-input and gate
nand3 a -> a -> a -> a 3-input not-and gate
or3 a -> a -> a -> a 3-input inclusive or gate
nor3 a -> a -> a -> a 3-input not-or gate
xor3 a -> a -> a -> a 3-input exclusive or gate
xnor3 a -> a -> a -> a negation of xor3
and4 a -> a -> a -> a -> a 4-input and gate
nand4 a -> a -> a -> a -> a 4-input not-and gate
or4 a -> a -> a -> a -> a 4-input inclusive or gate
nor4 a -> a -> a -> a -> a 4-input not-or gate
xor4 a -> a -> a -> a -> a 4-input exclusive or gate
xnor4 a -> a -> a -> a -> a negation of xor4

Basic combinational circuits

Component Type Description
mux1 a -> a -> a -> a multiplexor: mux1 p a b = if p=0 then a else b
mux2 a -> a -> a -> a multiplexor with 2 control bits:
mux2 p a b c d =
if p=(0,0) then a, (0,1) then b
(1,0) then c, (1,1) then d