eight_bit_computer.operations.addc_op module

The ADDC operation

Adds a value to the accumulator, adding an extra 1 if the overflow flag is set.

eight_bit_computer.operations.addc_op.generate_microcode_templates()[source]

Generate microcode for the ADDC instruction.

Returns:DataTemplates for all the ADDC instructions.
Return type:list(DataTemplate)
eight_bit_computer.operations.addc_op.generate_signatures()[source]

Generate all the argument signatures for the ADDC 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.addc_op.generate_operation_templates(signature)[source]

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

Parameters:signature (list(dict)) – List of argument definitions that specify which particular ADDC operation to generate templates for.
Returns:DataTemplates that define the operation with this signature.
Return type:list(DataTemplate)
eight_bit_computer.operations.addc_op.get_calculation_control_steps(signature)[source]

Get control steps that calcuate the new value.

Parameters:signature (list(dict)) – List of argument definitions that specify which particular ADDC operation to generate templates for.
Returns:List of list of bitdefs that specify the control steps.
Return type:list(list(str))
Raises:ValueError – When the signature’s first argument type is not a module name or constant.
eight_bit_computer.operations.addc_op.generate_true_data_templates(instruction_byte_bitdefs, initial_control_steps)[source]

Create datatemplates for an ADDC where an extra bit is needed.

Parameters:
  • instruction_byte_bitdefs (list(str)) – List of the bitdefs that make up the instruction byte.
  • initial_control_steps (list(list(str))) – List of list of bitdefs that specify the control steps.
Returns:

: List of DataTemplates that describe the ADDC for this signature when the carry flag is high.

Return type:

list(DataTemplate)

eight_bit_computer.operations.addc_op.generate_false_data_templates(instruction_byte_bitdefs, initial_control_steps)[source]

Create datatemplates for an ADDC where an extra bit is not needed.

Parameters:
  • instruction_byte_bitdefs (list(str)) – List of the bitdefs that make up the instruction byte.
  • initial_control_steps (list(list(str))) – List of list of bitdefs that specify the control steps.
Returns:

: List of DataTemplates that describe the ADDC for this signature when the carry flag is low.

Return type:

list(DataTemplate)

eight_bit_computer.operations.addc_op.generate_instruction_byte_bitdefs(signature)[source]

Generate bitdefs to specify the instruction byte for this signature.

Parameters:signature (list(dict)) – List of argument definitions that specify which particular simple ALU operation to generate the instruction byte bitdefs for.
Returns:Bitdefs that make up the instruction_byte
Return type:list(str)
eight_bit_computer.operations.addc_op.parse_line(line)[source]

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

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

Parameters:line (str) – Assembly line to be parsed.
Returns:List of machine code byte template dictionaries or an empty list.
Return type:list(dict)