API Reference
- implspec.generate16Bits(bits16=0)
- Parameters:
bits (int) – Binary number of size 16.
- Returns:
Tuple-Binary of type tuple.
- implspec.generate4Bits(bits4=0)
- Parameters:
bits (int) – Binary number of size 4.
- Returns:
Tuple-Binary of type tuple.
- implspec.generate8Bits(bits8=0)
- Parameters:
bits (int) – Binary number of size 8.
- Returns:
Tuple-Binary of type tuple.
- implspec.generateStreamBits(bit)
- Parameters:
bit (int) – Binary digit.
- Returns:
16-bits of inputed bit of type int.
- implspec.isLessThanZero(tuple_binary)
- Parameters:
tuple (()) – A Tuple-Binary value.
- Returns:
1st bit of tuple of type int.
- implspec.pushToTuple(array, bits)
- Parameters:
array ([]) – Preinitialised array of size n.
bits (int) – Binary number of size n.
- Returns:
Tuple-Binary of type tuple.
- implspec.tupleToBinary(tuple_binary)
- Parameters:
tuple (()) – A Tuple-Binary value.
- Returns:
16-bit number of type int.
- class units.LogicGates
- and_gate(a, b)
- Parameters:
a (int) – Binary value.
b (int) – Binary value.
- Returns:
Binary value of type int.
- invert(a)
- Parameters:
a (int) – Binary value.
- Returns:
Binary value of type int.
- nand_gate(a, b)
- Parameters:
a (int) – Binary value.
b (int) – Binary value.
- Returns:
Binary value of type int.
- or_gate(a, b)
- Parameters:
a (int) – Binary value.
b (int) – Binary value.
- Returns:
Binary value of type int.
- xor_gate(a, b)
- Parameters:
a (int) – Binary value.
b (int) – Binary value.
- Returns:
Binary value of type int.
- class units.LogicGates16
- and_gate(bits16_one, bits16_two)
- Parameters:
bits16_one (int) – 16-bit binary value.
bits16_two (int) – 16-bit binary value.
- Returns:
Tuple-Binary value of type tuple.
- invert(bits16)
- Parameters:
bits16 (int) – 16-bit binary value.
- Returns:
Tuple-Binary value of type tuple.
- nand_gate(bits16_one, bits16_two)
- Parameters:
bits16_one (int) – 16-bit binary value.
bits16_two (int) – 16-bit binary value.
- Returns:
Tuple-Binary value of type tuple.
- or_gate(bits16_one, bits16_two)
- Parameters:
bits16_one (int) – 16-bit binary value.
bits16_two (int) – 16-bit binary value.
- Returns:
Tuple-Binary value of type tuple.
- xor_gate(bits16_one, bits16_two)
- Parameters:
bits16_one (int) – 16-bit binary value.
bits16_two (int) – 16-bit binary value.
- Returns:
Tuple-Binary value of type tuple.
- class units.HalfAdder
- add(a, b)
- Parameters:
a (int) – Binary value.
b (int) – Binary value.
- Returns:
(high_bit, low_bit).
- class units.FullAdder
- add(a, b, carry)
- Parameters:
a (int) – Binary value.
b (int) – Binary value.
carry (int) – Binary value.
- Returns:
(high_bit, low_bit).
- class units.MultiBitAdder
- add(a1, a2, b1, b2, carry)
- Parameters:
a1 (int) – Binary value.
a2 (int) – Binary value.
b1 (int) – Binary value.
b2 (int) – Binary value.
carry (int) – Binary value.
- Returns:
(carry, low_two, low_one).
- class units.BitAdder16
- add(bits16_one, bits16_two, carry)
- Parameters:
bits16_one (int) – 16-bit binary value.
bits16_two (int) – 16-bit binary value.
carry (int) – Binary value.
- Returns:
Tuple-Binary result of type tuple.
- class units.Increment16
- inc(bits16=0)
- Parameters:
bits16 (int) – 16-bit binary value (optional).
- Returns:
Tuple-Binary result of type tuple.
- class units.Subtract16
- sub(bits16_one, bits16_two)
- Parameters:
bits16_one (int) – 16-bit binary value.
bits16_two (int) – 16-bit binary value.
- Returns:
Tuple-Binary result of type tuple.
- class units.Switch
- select(d1, d2, stream)
- Parameters:
d1 (int) – Binary value.
d2 (int) – Binary value.
stream (int) – Binary value.
- Returns:
Binary value out.
- select_16(d1_16bits, d2_16bits, stream)
- Parameters:
d1_16bits (int) – 16-bit binary value..
d2_16bits (int) – 16-bit binary value..
stream (int) – Binary value.
- Returns:
16-bit binary of type int.
- switch(d, stream)
- Parameters:
d1 (int) – Binary value.
stream (int) – Binary value.
- Returns:
Tuple-Binary (high_bit, low_bit).
- class units.LogicUnit
- calc(op1, op2, bits16_one, bits16_two)
- Parameters:
op1 (int) – Binary value.
op2 (int) – Binary value.
16bits_one (int) – 16-bit binary value..
16bits_two (int) – 16-bit binary value..
- Returns:
16-bit binary of type int.
- class units.ArithmeticUnit
- calc(op1, op2, bits16_one, bits16_two)
- Parameters:
op1 (int) – Binary value.
op2 (int) – Binary value.
16bits_one (int) – 16-bit binary value..
16bits_two (int) – 16-bit binary value..
- Returns:
16-bit binary of type int.
- class units.ALU
- calc(logic_or_arith, op1, op2, zero_replace, swap, bits16_one, bits16_two)
- Parameters:
logic_or_arith (int) – Binary value.
op1 (int) – Binary value.
op2 (int) – Binary value.
zero_replace (int) – Binary value.
swap (int) – Binary value.
16bits_one (int) – 16-bit binary value..
16bits_two (int) – 16-bit binary value..
- Returns:
16-bit binary of type int.
- class units.Conditions
- calc(lt, gt, eq, bits16)
- Parameters:
lt (int) – Binary value.
gt (int) – Binary value.
eq (int) – Binary value.
16bits (int) – 16-bit binary value..
- Returns:
Binary of type int.
- class memory.SRLatch
- data(set, reset)
- Parameters:
set (int) – Binary value.
reset (int) – Binary value.
- Returns:
Binary value of type int.
- class memory.DataLatch
- data(data, high)
- Parameters:
data (int) – Binary value.
high (int) – Binary value.
- Returns:
Binary value of type int.
- class memory.DataFlipFlop
- data(set, data, clock)
- Parameters:
set (int) – Binary value.
data (int) – Binary value.
clock (int) – Binary value.
- Returns:
Binary value of type int.
- class memory.Register
- read()
- Returns:
Tuple-Binary value of type tuple.
- write(set, bits16, clock)
- Parameters:
set (int) – Binary value.
bits16 (int) – 16-bit binary value.
clock (int) – Binary value.
- Returns:
Tuple-Binary value of type tuple.
- class memory.Counter
- inc(stream, bits16, clock)
- Parameters:
stream (int) – Binary value.
bits16 (int) – 16-bit binary value.
clock (int) – Binary value.
- Returns:
Tuple-Binary value of type tuple.
- class memory.RAM
- read(bits16)
- Parameters:
bits16 (int) – 16-bit binary value.
- Returns:
16-bit binary value of type int.
- write(set, address, value, clock)
- Parameters:
set (int) – Binary value.
address (int) – 16-bit binary value.
value (int) – 16-bit binary value.
clock (int) – Binary value.
- Returns:
16-bit binary value of type int.
- class processor.UnifiedMemory
- write(a, b, ram, bits16, clock)
Bits16 refers to the store value
- Parameters:
a (int) – Binary value.
b (int) – Binary value.
ram (int) – Binary value.
bits16 (int) – 16-bit binary value.
clock (int) – Binary value.
- Returns:
Binary value of type int.
- class processor.Instruction
- calc(bits16, a_register, b_register, ram)
bits16 refers to the instruction
- Parameters:
bits16 (int) – 16-bit binary value.
a_register (int) – 16-bit binary value.
b_register (int) – 16-bit binary value.
ram (int) – 16-binary value.
- Returns:
alu value, conditional is true, a register, b register, ram
- class processor.ControlUnit
- calc(bits16, a_register, b_register, ram)
bits16 refers to the instruction
- Parameters:
bits16 (int) – 16-bit binary value.
a_register (int) – 16-bit binary value.
b_register (int) – 16-bit binary value.
ram (int) – 16-binary value.
- Returns:
output value, conditional is true, a register, b register, ram