eight_bit_computer.operations.simple_alu_op_base module

Base for simple ALU operations

eight_bit_computer.operations.simple_alu_op_base.generate_microcode_templates(alu_op, control_flags)[source]

Generate microcode for all the ADD instructions.

Parameters:
  • alu_op (str) – The ALU operation to perform - one of the ALU_OPERATIONS.
  • control_flags (list(str)) – List of ALU control flags for this ALU operation. One of the ALU_CONTROL_FLAGS.
Returns:

DataTemplates for all the ADD instructions.

Return type:

list(DataTemplate)

eight_bit_computer.operations.simple_alu_op_base.generate_signatures()[source]

Generate all the argument signatures for the ADD operation.

Returns:All possible signatures, See get_arg_def_template() for more information on an argument definition dictionary.
Return type:list(list(dict))
eight_bit_computer.operations.simple_alu_op_base.generate_operation_templates(signature, alu_op, control_flags)[source]

Create the DataTemplates to define a ADD with the given signature.

Parameters:
  • signature (list(dict)) – List of argument definitions that specify which particular ADD operation to generate templates for.
  • alu_op (str) – The ALU operation to perform - one of the ALU_OPERATIONS.
  • control_flags (list(str)) – List of ALU control flags for this ALU operation. One of the ALU_CONTROL_FLAGS.
Returns:

DataTemplates that define this ADD.

Return type:

list(DataTemplate)

eight_bit_computer.operations.simple_alu_op_base.generate_instruction_byte_bitdefs(signature, alu_op)[source]

Generate bitdefs to specify the instruction byte for this signature.

Parameters:
  • signature (list(dict)) – List of argument definitions that specify which particular ADD operation to generate the instruction byte bitdefs for.
  • alu_op (str) – The ALU operation to perform - one of the ALU_OPERATIONS.
Returns:

Bitdefs that make up the instruction_byte

Return type:

list(str)

eight_bit_computer.operations.simple_alu_op_base.generate_control_steps(signature, control_flags)[source]

Generate control steps for this signature.

Parameters:
  • signature (list(dict)) – List of argument definitions that specify which particular ADD operation to generate the control steps for.
  • control_flags (list(str)) – List of ALU control flags for this ALU operation. One of the ALU_CONTROL_FLAGS.
Returns:

List of list of bitdefs that specify the control steps.

Return type:

list(list(str))

eight_bit_computer.operations.simple_alu_op_base.parse_line(line, name, alu_op)[source]

Parse a line of assembly code to create machine code byte templates.

If a line is not identifiably a ADD assembly line, return an empty list instead.

Parameters:
  • line (str) – Assembly line to be parsed.
  • name (str) – Name of the Operation.
  • alu_op (str) – The ALU operation to perform - one of the ALU_OPERATIONS.
Returns:

List of machine code byte template dictionaries or an empty list.

Return type:

list(dict)