Package hw4
Class Multiplexer
- java.lang.Object
-
- hw4.AbstractComponent
-
- hw4.Multiplexer
-
- All Implemented Interfaces:
IComponent
public class Multiplexer extends AbstractComponent
Implementation of a single-output multiplexer.- Author:
- smkautz
-
-
Constructor Summary
Constructors Constructor Description Multiplexer(int k)
Constructs a multiplexer that uses k bits to select from one of 2^k inputs.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
propagate()
Propagates inputs to outputs.-
Methods inherited from class hw4.AbstractComponent
inputs, inputsValid, invalidateInputs, invalidateOutputs, outputs, outputsValid
-
-
-
-
Constructor Detail
-
Multiplexer
public Multiplexer(int k)
Constructs a multiplexer that uses k bits to select from one of 2^k inputs. The total number of inputs is 2^k + k, where the last k inputs are interpreted as a binary number to select one of the first 2^k inputs to be the output value.- Parameters:
k
- number of selection bits
-
-
Method Detail
-
propagate
public void propagate()
Description copied from interface:IComponent
Propagates inputs to outputs. Does nothing if not all inputs are valid.
-
-