From 4ba119cab03498736851e6f3f32eec1957839a2e Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Sun, 15 Sep 2019 14:32:44 +0200 Subject: [PATCH] Apply formatter, optional problems, save actions to machine project --- .../.settings/org.eclipse.jdt.core.prefs | 449 ++++++++++++++++++ .../.settings/org.eclipse.jdt.ui.prefs | 63 +++ .../net/mograsim/machine/AddressingScema.java | 5 +- .../net/mograsim/machine/GenericMemory.java | 8 +- .../src/net/mograsim/machine/ISA.java | 3 +- .../src/net/mograsim/machine/ISASchema.java | 5 +- .../src/net/mograsim/machine/Machine.java | 19 +- .../mograsim/machine/MachineDefinition.java | 15 +- .../mograsim/machine/MachineException.java | 4 +- .../net/mograsim/machine/MachineRegistry.java | 2 +- .../machine/MainMemoryDefinition.java | 9 +- .../src/net/mograsim/machine/Memory.java | 13 +- .../mograsim/machine/MemoryDefinition.java | 11 +- .../src/net/mograsim/machine/Register.java | 23 +- .../machine/StandardMainMemoryDefinition.java | 5 +- .../machine/StandardMemoryDefinition.java | 7 +- .../mograsim/machine/mi/MicroInstruction.java | 14 +- .../mi/MicroInstructionDefinition.java | 13 +- .../MicroInstructionMemoryParseException.java | 2 +- .../mi/MicroInstructionMemoryParser.java | 17 +- .../machine/mi/StandardMicroInstruction.java | 2 +- .../mi/StandardMicroInstructionMemory.java | 10 +- .../CoreMicroInstructionMemory.java | 11 +- .../ModelMicroInstructionMemory.java | 3 +- .../mi/parameters/BooleanClassification.java | 5 +- .../mi/parameters/IntegerClassification.java | 4 +- .../mi/parameters/IntegerImmediate.java | 8 +- .../parameters/MicroInstructionParameter.java | 4 +- .../machine/mi/parameters/Mnemonic.java | 6 +- .../machine/mi/parameters/MnemonicFamily.java | 76 +-- .../parameters/ParameterClassification.java | 7 +- .../parameters/UnknownMnemonicException.java | 4 +- .../memory/CoreWordAddressableMemory.java | 28 +- .../standard/memory/MemoryException.java | 4 +- .../memory/ModelWordAddressableMemory.java | 4 +- .../memory/WordAddressableMemory.java | 2 +- .../memory/WordAddressableMemoryTest.java | 10 +- 37 files changed, 699 insertions(+), 176 deletions(-) create mode 100644 net.mograsim.machine/.settings/org.eclipse.jdt.ui.prefs diff --git a/net.mograsim.machine/.settings/org.eclipse.jdt.core.prefs b/net.mograsim.machine/.settings/org.eclipse.jdt.core.prefs index cd95f141..f8bd225a 100644 --- a/net.mograsim.machine/.settings/org.eclipse.jdt.core.prefs +++ b/net.mograsim.machine/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,456 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=info +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=info +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=info +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=info +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.release=enabled org.eclipse.jdt.core.compiler.source=11 +org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false +org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false +org.eclipse.jdt.core.formatter.align_with_spaces=false +org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 +org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0 +org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 +org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=next_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=next_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line +org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true +org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.indent_tag_description=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=140 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert +org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false +org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.lineSplit=140 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 +org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.use_on_off_tags=true +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true +org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false +org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true +org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true +org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true +org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true +org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/net.mograsim.machine/.settings/org.eclipse.jdt.ui.prefs b/net.mograsim.machine/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000..8f2c0a47 --- /dev/null +++ b/net.mograsim.machine/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,63 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_MoGraSim +formatter_settings_version=16 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_functional_interfaces=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.insert_inferred_type_arguments=false +sp_cleanup.make_local_variable_final=true +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=false +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_redundant_modifiers=false +sp_cleanup.remove_redundant_semicolons=false +sp_cleanup.remove_redundant_type_arguments=false +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=true +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/net.mograsim.machine/src/net/mograsim/machine/AddressingScema.java b/net.mograsim.machine/src/net/mograsim/machine/AddressingScema.java index 884fa0bf..eab88b97 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/AddressingScema.java +++ b/net.mograsim.machine/src/net/mograsim/machine/AddressingScema.java @@ -1,5 +1,6 @@ package net.mograsim.machine; -public interface AddressingScema { - +public interface AddressingScema +{ + } diff --git a/net.mograsim.machine/src/net/mograsim/machine/GenericMemory.java b/net.mograsim.machine/src/net/mograsim/machine/GenericMemory.java index f01f9df8..80520140 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/GenericMemory.java +++ b/net.mograsim.machine/src/net/mograsim/machine/GenericMemory.java @@ -22,7 +22,7 @@ public abstract class GenericMemory implements Memory this.maximalAddress = definition.getMaximalAddress(); this.pages = new HashMap<>(); } - + private void inBoundsCheck(long address) { if (address < minimalAddress || address > maximalAddress) @@ -34,12 +34,12 @@ public abstract class GenericMemory implements Memory { return address / pageSize; } - + private int offset(long address) { return (int) (address % pageSize); } - + @Override public void setCell(long address, T data) { @@ -110,7 +110,7 @@ public abstract class GenericMemory implements Memory { observers.forEach(ob -> ob.update(address)); } - + @Override public MemoryDefinition getDefinition() { diff --git a/net.mograsim.machine/src/net/mograsim/machine/ISA.java b/net.mograsim.machine/src/net/mograsim/machine/ISA.java index 9f322e4b..eaec0d94 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/ISA.java +++ b/net.mograsim.machine/src/net/mograsim/machine/ISA.java @@ -1,4 +1,5 @@ package net.mograsim.machine; -public interface ISA { +public interface ISA +{ } diff --git a/net.mograsim.machine/src/net/mograsim/machine/ISASchema.java b/net.mograsim.machine/src/net/mograsim/machine/ISASchema.java index 249a8925..72e66855 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/ISASchema.java +++ b/net.mograsim.machine/src/net/mograsim/machine/ISASchema.java @@ -4,8 +4,9 @@ import java.util.Set; import net.mograsim.machine.isa.AsmOperand; -public interface ISASchema { +public interface ISASchema +{ Set getSupportedOperands(); - + AddressingScema getAddressingSchema(); } diff --git a/net.mograsim.machine/src/net/mograsim/machine/Machine.java b/net.mograsim.machine/src/net/mograsim/machine/Machine.java index 0849b8a6..6ff074d0 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/Machine.java +++ b/net.mograsim.machine/src/net/mograsim/machine/Machine.java @@ -6,23 +6,24 @@ import net.mograsim.logic.core.types.BitVector; import net.mograsim.machine.mi.MicroInstructionMemory; import net.mograsim.logic.model.model.LogicModel; -public interface Machine { +public interface Machine +{ MachineDefinition getDefinition(); - + void reset(); - + LogicModel getModel(); - + CoreClock getClock(); - + BitVector getRegister(Register r); - + void setRegister(Register r, BitVector value); Timeline getTimeline(); - + MainMemory getMainMemory(); - + MicroInstructionMemory getMicroInstructionMemory(); - + } diff --git a/net.mograsim.machine/src/net/mograsim/machine/MachineDefinition.java b/net.mograsim.machine/src/net/mograsim/machine/MachineDefinition.java index 0414b7ee..02cf3757 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/MachineDefinition.java +++ b/net.mograsim.machine/src/net/mograsim/machine/MachineDefinition.java @@ -4,7 +4,8 @@ import java.util.Set; import net.mograsim.machine.mi.MicroInstructionMemoryDefinition; -public interface MachineDefinition { +public interface MachineDefinition +{ /** * Creates a new instance of the machine @@ -15,8 +16,7 @@ public interface MachineDefinition { Machine createNew(); /** - * Returns the schema that all possible ISAs (Instruction Set Architecture) must - * be based on. + * Returns the schema that all possible ISAs (Instruction Set Architecture) must be based on. * * @return an {@link ISASchema} implementation fitting the machine * @author Christian Femers @@ -32,9 +32,8 @@ public interface MachineDefinition { Set getRegisters(); /** - * The number of bits used by the machine to address main memory. Note that this - * should be the number of bits used in the CPU, not a possibly different one - * used by the bus system. + * The number of bits used by the machine to address main memory. Note that this should be the number of bits used in the CPU, not a + * possibly different one used by the bus system. * * @return the number of bits used by the CPU * @see MainMemoryDefinition#getMemoryAddressBits() @@ -49,12 +48,12 @@ public interface MachineDefinition { * @author Christian Femers */ MainMemoryDefinition getMainMemoryDefinition(); - + /** * Returns the definition of the machines instruction memory. * * @return the {@link InstructionMemoryDefinition} that defines the instruction memory. */ MicroInstructionMemoryDefinition getMicroInstructionMemoryDefinition(); - + } diff --git a/net.mograsim.machine/src/net/mograsim/machine/MachineException.java b/net.mograsim.machine/src/net/mograsim/machine/MachineException.java index e41fca74..ee9026a7 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/MachineException.java +++ b/net.mograsim.machine/src/net/mograsim/machine/MachineException.java @@ -12,12 +12,12 @@ public class MachineException extends RuntimeException { super(); } - + public MachineException(String message) { super(message); } - + public MachineException(Throwable cause) { super(cause); diff --git a/net.mograsim.machine/src/net/mograsim/machine/MachineRegistry.java b/net.mograsim.machine/src/net/mograsim/machine/MachineRegistry.java index 47da15bf..a2706462 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/MachineRegistry.java +++ b/net.mograsim.machine/src/net/mograsim/machine/MachineRegistry.java @@ -29,7 +29,7 @@ public class MachineRegistry System.out.println(Arrays.toString(e.getAttributeNames())); final Object o = e.createExecutableExtension("class"); final String id = e.getAttribute("unique_id"); - if (o instanceof MachineDefinition) + if (o instanceof MachineDefinition) { System.out.println("Found " + id); installedMachines.put(id, (MachineDefinition) o); diff --git a/net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java b/net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java index 4f696736..72153d6d 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java +++ b/net.mograsim.machine/src/net/mograsim/machine/MainMemoryDefinition.java @@ -1,8 +1,7 @@ package net.mograsim.machine; /** - * This interface provides a means to get information about the machines memory - * architecture. It is not bound to any actual memory. + * This interface provides a means to get information about the machines memory architecture. It is not bound to any actual memory. * * @author Christian Femers * @@ -10,14 +9,14 @@ package net.mograsim.machine; public interface MainMemoryDefinition extends MemoryDefinition { /** - * The width in bits of an addressable memory cell/unit. This is often 8 (= one - * byte). The actual cells/lines of the memory may be a lot larger. + * The width in bits of an addressable memory cell/unit. This is often 8 (= one byte). The actual cells/lines of the memory may be a lot + * larger. * * @return the addressable unit width in bits * @author Christian Femers */ int getCellWidth(); - + public static MainMemoryDefinition create(int memoryAddressBits, int cellWidth, long minimalAddress, long maximalAddress) { return new StandardMainMemoryDefinition(memoryAddressBits, cellWidth, minimalAddress, maximalAddress); diff --git a/net.mograsim.machine/src/net/mograsim/machine/Memory.java b/net.mograsim.machine/src/net/mograsim/machine/Memory.java index 77c0d48b..0ff9bb41 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/Memory.java +++ b/net.mograsim.machine/src/net/mograsim/machine/Memory.java @@ -9,27 +9,28 @@ public interface Memory * @throws IndexOutOfBoundsException */ public T getCell(long address); - + /** * Sets the data at the supplied address + * * @throws IndexOutOfBoundsException */ public void setCell(long address, T data); - + public default long size() { MemoryDefinition def = getDefinition(); return Long.max(0, def.getMaximalAddress() - def.getMinimalAddress() + 1); } - + /** * Registers an observer to be notified when a memory cell is modified */ public void registerObserver(MemoryObserver ob); - + public void deregisterObserver(MemoryObserver ob); - + public void notifyObservers(long address); - + public MemoryDefinition getDefinition(); } diff --git a/net.mograsim.machine/src/net/mograsim/machine/MemoryDefinition.java b/net.mograsim.machine/src/net/mograsim/machine/MemoryDefinition.java index 78e1e4e2..39d12c44 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/MemoryDefinition.java +++ b/net.mograsim.machine/src/net/mograsim/machine/MemoryDefinition.java @@ -1,10 +1,11 @@ package net.mograsim.machine; -public interface MemoryDefinition { +public interface MemoryDefinition +{ /** - * The number of bits that the main memory uses to address cells. Note that this - * does not need to equal {@link MachineDefinition#getAddressBits()}. + * The number of bits that the main memory uses to address cells. Note that this does not need to equal + * {@link MachineDefinition#getAddressBits()}. * * @return the number of bits used to address a memory cell * @author Christian Femers @@ -26,7 +27,7 @@ public interface MemoryDefinition { * @author Christian Femers */ long getMaximalAddress(); - + /** * The size of the MainMemory as the amount of addressable memory cells. * @@ -36,7 +37,7 @@ public interface MemoryDefinition { { return getMaximalAddress() - getMinimalAddress() + 1; } - + public static MemoryDefinition create(int memoryAddressBits, long minimalAddress, long maximalAddress) { return new StandardMemoryDefinition(memoryAddressBits, minimalAddress, maximalAddress); diff --git a/net.mograsim.machine/src/net/mograsim/machine/Register.java b/net.mograsim.machine/src/net/mograsim/machine/Register.java index 5ecf1cfc..4bcb7f25 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/Register.java +++ b/net.mograsim.machine/src/net/mograsim/machine/Register.java @@ -3,17 +3,16 @@ package net.mograsim.machine; import java.util.Set; /** - * A register in a machine is defined by this interface. A hardware register may - * have {@link Register#names() named sub-registers}. + * A register in a machine is defined by this interface. A hardware register may have {@link Register#names() named sub-registers}. * * * @author Christian Femers * */ -public interface Register { +public interface Register +{ /** - * The unique identifier of the register. This does not have to be the display - * name or name in the assembly language. + * The unique identifier of the register. This does not have to be the display name or name in the assembly language. * * @return the registers id as case sensitive String * @author Christian Femers @@ -21,21 +20,17 @@ public interface Register { String id(); /** - * The name(s) of this register. This is the displayed name and the name used in - * the assembly language. All names of all registers must be case-insensitive - * unique. A register can have multiple names if these names address different - * regions (but still have a common hardware structure), e.g. EAX, - * AX, AL, AH. + * The name(s) of this register. This is the displayed name and the name used in the assembly language. All names of all registers must + * be case-insensitive unique. A register can have multiple names if these names address different regions (but still have a common + * hardware structure), e.g. EAX, AX, AL, AH. * - * @return all the names of regions addressing this register, must be - * case-insensitive. + * @return all the names of regions addressing this register, must be case-insensitive. * @author Christian Femers */ Set names(); /** - * Returns the complete width in bits of the underlying hardware structure the - * register and possible sub-registers are part of. + * Returns the complete width in bits of the underlying hardware structure the register and possible sub-registers are part of. * * @param name the name of the register * @return the width of the (sub-)register in bits. diff --git a/net.mograsim.machine/src/net/mograsim/machine/StandardMainMemoryDefinition.java b/net.mograsim.machine/src/net/mograsim/machine/StandardMainMemoryDefinition.java index 1e3bd50c..22be93ee 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/StandardMainMemoryDefinition.java +++ b/net.mograsim.machine/src/net/mograsim/machine/StandardMainMemoryDefinition.java @@ -1,8 +1,9 @@ package net.mograsim.machine; -class StandardMainMemoryDefinition extends StandardMemoryDefinition implements MainMemoryDefinition { +class StandardMainMemoryDefinition extends StandardMemoryDefinition implements MainMemoryDefinition +{ private final int cellWidth; - + StandardMainMemoryDefinition(int memoryAddressBits, int cellWidth, long minimalAddress, long maximalAddress) { super(memoryAddressBits, minimalAddress, maximalAddress); diff --git a/net.mograsim.machine/src/net/mograsim/machine/StandardMemoryDefinition.java b/net.mograsim.machine/src/net/mograsim/machine/StandardMemoryDefinition.java index 7ba5fb87..f0d755f5 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/StandardMemoryDefinition.java +++ b/net.mograsim.machine/src/net/mograsim/machine/StandardMemoryDefinition.java @@ -1,9 +1,10 @@ package net.mograsim.machine; -class StandardMemoryDefinition implements MemoryDefinition { +class StandardMemoryDefinition implements MemoryDefinition +{ private final int memoryAddressBits; private final long minimalAddress, maximalAddress; - + StandardMemoryDefinition(int memoryAddressBits, long minimalAddress, long maximalAddress) { super(); @@ -34,7 +35,7 @@ class StandardMemoryDefinition implements MemoryDefinition { { return maximalAddress; } - + public static MemoryDefinition create(int memoryAddressBits, long minimalAddress, long maximalAddress) { return new StandardMemoryDefinition(memoryAddressBits, minimalAddress, maximalAddress); diff --git a/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstruction.java b/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstruction.java index d88a8efb..92e33ebe 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstruction.java +++ b/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstruction.java @@ -4,26 +4,28 @@ import net.mograsim.logic.core.types.BitVector; import net.mograsim.machine.mi.parameters.MicroInstructionParameter; import net.mograsim.machine.mi.parameters.Mnemonic; -public interface MicroInstruction { - +public interface MicroInstruction +{ + public MicroInstructionParameter getParameter(int index); + public void setParameter(int index, MicroInstructionParameter param); - + /** * @return The amount of {@link Mnemonic}s, the instruction is composed of */ public int getSize(); - + public static MicroInstruction create(MicroInstructionParameter... parameters) { return new StandardMicroInstruction(parameters); } - + default BitVector toBitVector() { BitVector vector = BitVector.of(); int size = getSize(); - for(int i = 0; i < size; i++) + for (int i = 0; i < size; i++) vector.concat(getParameter(i).getValue()); return vector; } diff --git a/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstructionDefinition.java b/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstructionDefinition.java index b9cd2ef7..fcdbdc48 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstructionDefinition.java +++ b/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstructionDefinition.java @@ -18,13 +18,12 @@ public interface MicroInstructionDefinition * @return The {@link ParameterClassification}s of which a MicroInstruction is composed. */ public ParameterClassification[] getParameterClassifications(); - + /** * @throws IndexOutOfBoundsException */ public ParameterClassification getParameterClassification(int index); - - + /** * @return The amount of {@link MicroInstructionParameter}s in a {@link MicroInstruction} that follows this definition. */ @@ -32,7 +31,7 @@ public interface MicroInstructionDefinition { return getParameterClassifications().length; } - + /** * @return The amount of {@link Bit}s in a {@link MicroInstruction} that follows this definition. */ @@ -40,18 +39,18 @@ public interface MicroInstructionDefinition { return Arrays.stream(getParameterClassifications()).mapToInt(e -> e.getExpectedBits()).reduce(0, (a, b) -> a + b); } - + public default MicroInstruction createDefaultInstruction() { int size = size(); MicroInstructionParameter[] params = new MicroInstructionParameter[size]; ParameterClassification[] classes = getParameterClassifications(); - for(int i = 0; i < size; i++) + for (int i = 0; i < size; i++) { MicroInstructionParameter newParam; ParameterClassification classification = classes[i]; ParameterType type = classification.getExpectedType(); - switch(type) + switch (type) { case BOOLEAN_IMMEDIATE: case MNEMONIC: diff --git a/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstructionMemoryParseException.java b/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstructionMemoryParseException.java index 674e4185..66aa229c 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstructionMemoryParseException.java +++ b/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstructionMemoryParseException.java @@ -24,5 +24,5 @@ public class MicroInstructionMemoryParseException extends MachineException { super(cause); } - + } diff --git a/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstructionMemoryParser.java b/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstructionMemoryParser.java index b5117a75..cacf7998 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstructionMemoryParser.java +++ b/net.mograsim.machine/src/net/mograsim/machine/mi/MicroInstructionMemoryParser.java @@ -28,29 +28,29 @@ public class MicroInstructionMemoryParser long minAddr = def.getMinimalAddress(); long maxAddr = def.getMaximalAddress(); - + String line; long i = minAddr; try { for (; i <= maxAddr && input.ready() && !"".equals((line = input.readLine())); i++) memory.setCell(i, parse(miDef, line)); - } catch (IOException e) + } + catch (IOException e) { e.printStackTrace(); } - - for(; i <= maxAddr; i++) + + for (; i <= maxAddr; i++) memory.setCell(i, miDef.createDefaultInstruction()); } - + public static MicroInstruction parse(MicroInstructionDefinition definition, String toParse) { int size = definition.size(); String[] strings = toParse.split(","); if (size != strings.length) - throw new MicroInstructionMemoryParseException( - "String does not match definition! The number of parameters does not match."); + throw new MicroInstructionMemoryParseException("String does not match definition! The number of parameters does not match."); MicroInstructionParameter[] params = new MicroInstructionParameter[size]; ParameterClassification[] classes = definition.getParameterClassifications(); try @@ -60,7 +60,8 @@ public class MicroInstructionMemoryParser params[i] = classes[i].parse(strings[i]); } return new StandardMicroInstruction(params); - } catch (Exception e) + } + catch (Exception e) { throw new MicroInstructionMemoryParseException(e.getCause()); } diff --git a/net.mograsim.machine/src/net/mograsim/machine/mi/StandardMicroInstruction.java b/net.mograsim.machine/src/net/mograsim/machine/mi/StandardMicroInstruction.java index e40350df..a151042d 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/mi/StandardMicroInstruction.java +++ b/net.mograsim.machine/src/net/mograsim/machine/mi/StandardMicroInstruction.java @@ -10,7 +10,7 @@ class StandardMicroInstruction implements MicroInstruction { this.parameters = parameters; } - + /** * @throws IndexOutOfBoundsException */ diff --git a/net.mograsim.machine/src/net/mograsim/machine/mi/StandardMicroInstructionMemory.java b/net.mograsim.machine/src/net/mograsim/machine/mi/StandardMicroInstructionMemory.java index c983561a..7ef53d90 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/mi/StandardMicroInstructionMemory.java +++ b/net.mograsim.machine/src/net/mograsim/machine/mi/StandardMicroInstructionMemory.java @@ -10,26 +10,26 @@ public class StandardMicroInstructionMemory implements MicroInstructionMemory private MicroInstruction[] data; private MicroInstructionMemoryDefinition definition; private HashSet observers = new HashSet<>(); - + public StandardMicroInstructionMemory(MicroInstructionMemoryDefinition definition) { - if(definition.size() > Integer.MAX_VALUE) + if (definition.size() > Integer.MAX_VALUE) throw new MemoryException("Size of MicroInstructionMemory must be an int, not a long"); this.definition = definition; data = new MicroInstruction[(int) definition.size()]; } - + private int translate(long address) { return (int) (address - definition.getMinimalAddress()); } - + @Override public MicroInstruction getCell(long address) { int translatedAddress = translate(address); MicroInstruction actual = data[translatedAddress]; - if(actual == null) + if (actual == null) actual = data[translatedAddress] = definition.getMicroInstructionDefinition().createDefaultInstruction(); return actual; } diff --git a/net.mograsim.machine/src/net/mograsim/machine/mi/components/CoreMicroInstructionMemory.java b/net.mograsim.machine/src/net/mograsim/machine/mi/components/CoreMicroInstructionMemory.java index eb472099..a958dc20 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/mi/components/CoreMicroInstructionMemory.java +++ b/net.mograsim.machine/src/net/mograsim/machine/mi/components/CoreMicroInstructionMemory.java @@ -13,10 +13,9 @@ import net.mograsim.machine.mi.MicroInstructionMemory; public class CoreMicroInstructionMemory extends BasicCoreComponent { - private final ReadWriteEnd data; - private final ReadEnd address; - private final MicroInstructionMemory memory; - + private final ReadWriteEnd data; + private final ReadEnd address; + private final MicroInstructionMemory memory; public CoreMicroInstructionMemory(Timeline timeline, int processTime, MicroInstructionMemory memory, ReadWriteEnd data, ReadEnd address) { @@ -46,9 +45,9 @@ public class CoreMicroInstructionMemory extends BasicCoreComponent @Override protected TimelineEventHandler compute() { - if(!address.hasNumericValue()) + if (!address.hasNumericValue()) { - return e -> data.feedSignals(Bit.U.toVector(data.width()));//TODO don't always feed U, but decide to feed X or U. + return e -> data.feedSignals(Bit.U.toVector(data.width()));// TODO don't always feed U, but decide to feed X or U. } long addressed = address.getUnsignedValue(); BitVector storedData = memory.getCell(addressed).toBitVector(); diff --git a/net.mograsim.machine/src/net/mograsim/machine/mi/components/ModelMicroInstructionMemory.java b/net.mograsim.machine/src/net/mograsim/machine/mi/components/ModelMicroInstructionMemory.java index c9af9a9f..94a4d0e0 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/mi/components/ModelMicroInstructionMemory.java +++ b/net.mograsim.machine/src/net/mograsim/machine/mi/components/ModelMicroInstructionMemory.java @@ -17,7 +17,8 @@ public abstract class ModelMicroInstructionMemory extends ModelMemory super(model, 120, 150, name, "MPM", false); this.definition = definition; addPin(addrPin = new Pin(model, this, "A", definition.getMemoryAddressBits(), PinUsage.INPUT, getWidth(), 30)); - addPin(dataPin = new Pin(model, this, "D", definition.getMicroInstructionDefinition().sizeInBits(), PinUsage.OUTPUT, getWidth(), 50)); + addPin(dataPin = new Pin(model, this, "D", definition.getMicroInstructionDefinition().sizeInBits(), PinUsage.OUTPUT, getWidth(), + 50)); init(); } diff --git a/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/BooleanClassification.java b/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/BooleanClassification.java index 8ee54985..28bf971b 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/BooleanClassification.java +++ b/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/BooleanClassification.java @@ -6,18 +6,19 @@ import net.mograsim.machine.mi.parameters.MicroInstructionParameter.ParameterTyp public class BooleanClassification extends MnemonicFamily { String trueName, falseName; + public BooleanClassification(String trueName, String falseName) { super(new MnemonicPair(trueName, BitVector.SINGLE_1), new MnemonicPair(falseName, BitVector.SINGLE_0)); this.trueName = trueName; this.falseName = falseName; } - + public Mnemonic get(boolean value) { return get(value ? trueName : falseName); } - + @Override public ParameterType getExpectedType() { diff --git a/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/IntegerClassification.java b/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/IntegerClassification.java index b28a4361..1a5003f6 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/IntegerClassification.java +++ b/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/IntegerClassification.java @@ -7,7 +7,7 @@ import net.mograsim.machine.mi.parameters.MicroInstructionParameter.ParameterTyp public class IntegerClassification implements ParameterClassification { private final int bits; - + public IntegerClassification(int bits) { this.bits = bits; @@ -24,7 +24,7 @@ public class IntegerClassification implements ParameterClassification { return bits; } - + @Override public IntegerImmediate parse(String toParse) { diff --git a/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/IntegerImmediate.java b/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/IntegerImmediate.java index 0a83121c..419602c6 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/IntegerImmediate.java +++ b/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/IntegerImmediate.java @@ -7,17 +7,17 @@ import net.mograsim.logic.core.types.BitVector; public final class IntegerImmediate implements MicroInstructionParameter { private BitVector value; - + public IntegerImmediate(BigInteger value, int bits) { this.value = BitVector.from(value, bits); } - + public IntegerImmediate(BitVector value) { this.value = value; } - + @Override public BitVector getValue() { @@ -65,7 +65,7 @@ public final class IntegerImmediate implements MicroInstructionParameter { return value.getUnsignedValue(); } - + @Override public String toString() { diff --git a/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/MicroInstructionParameter.java b/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/MicroInstructionParameter.java index ecff9f0b..2f135d29 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/MicroInstructionParameter.java +++ b/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/MicroInstructionParameter.java @@ -5,9 +5,9 @@ import net.mograsim.logic.core.types.BitVector; public interface MicroInstructionParameter { public BitVector getValue(); - + public ParameterType getType(); - + public static enum ParameterType { INTEGER_IMMEDIATE, BOOLEAN_IMMEDIATE, MNEMONIC diff --git a/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/Mnemonic.java b/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/Mnemonic.java index 14bbe3be..5ea2be05 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/Mnemonic.java +++ b/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/Mnemonic.java @@ -8,7 +8,7 @@ public final class Mnemonic implements MicroInstructionParameter private final BitVector vector; final MnemonicFamily owner; private final int ordinal; - + Mnemonic(String text, BitVector vector, MnemonicFamily owner, int ordinal) { super(); @@ -50,12 +50,12 @@ public final class Mnemonic implements MicroInstructionParameter { return owner.getExpectedType(); } - + public int ordinal() { return ordinal; } - + @Override public String toString() { diff --git a/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/MnemonicFamily.java b/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/MnemonicFamily.java index f4343bd0..7ed69f98 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/MnemonicFamily.java +++ b/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/MnemonicFamily.java @@ -13,110 +13,110 @@ public class MnemonicFamily implements ParameterClassification private final String[] stringValues; private Map byText; private int vectorLength; - + public MnemonicFamily(String... names) { this(false, (int) Math.round(Math.ceil(Math.log(names.length) / Math.log(2))), names); } - + public MnemonicFamily(boolean reverse, String... names) { this(reverse, (int) Math.round(Math.ceil(Math.log(names.length) / Math.log(2))), names); } - + public MnemonicFamily(int bits, String... names) { this(false, bits, names); } - + public MnemonicFamily(boolean reverse, int bits, String... names) { this.values = new Mnemonic[names.length]; this.stringValues = new String[names.length]; BitVector[] values = new BitVector[names.length]; - for(int i = 0; i < names.length; i++) + for (int i = 0; i < names.length; i++) { values[i] = BitVector.from(i, bits); } - + setup(names, values, reverse); } - + public MnemonicFamily(String[] names, long[] values, int bits) { this(false, names, values, bits); } - + public MnemonicFamily(boolean reverse, String[] names, long[] values, int bits) { - if(names.length != values.length) + if (names.length != values.length) throw new IllegalArgumentException(); this.values = new Mnemonic[values.length]; this.stringValues = new String[values.length]; BitVector[] vectors = new BitVector[values.length]; - - for(int i = 0; i < vectors.length; i++) + + for (int i = 0; i < vectors.length; i++) { vectors[i] = BitVector.from(values[i], bits); } - + setup(names, vectors, reverse); } - + public MnemonicFamily(String[] names, BitVector[] values) { this(false, names, values); } - + public MnemonicFamily(boolean reverse, String[] names, BitVector[] values) { - if(names.length != values.length) + if (names.length != values.length) throw new IllegalArgumentException(); this.values = new Mnemonic[values.length]; this.stringValues = new String[values.length]; - + setup(names, values, reverse); } - + public MnemonicFamily(MnemonicPair... values) { this(false, values); } - + public MnemonicFamily(boolean reverse, MnemonicPair... values) { this.values = new Mnemonic[values.length]; this.stringValues = new String[values.length]; - + setup(values); } - + private void setup(String[] names, BitVector[] values, boolean reverse) { MnemonicPair[] mnemonics = new MnemonicPair[values.length]; - for(int i = 0; i < values.length; i++) + for (int i = 0; i < values.length; i++) mnemonics[i] = new MnemonicPair(names[i], reverse ? values[i].reverse() : values[i]); setup(mnemonics); } - + private void setup(MnemonicPair[] values) { - for(int i = 0; i < values.length; i++) + for (int i = 0; i < values.length; i++) { this.values[i] = createMnemonic(values[i], i); this.stringValues[i] = values[i].name; } - if(values.length == 0) + if (values.length == 0) vectorLength = 0; else { vectorLength = values[0].value.length(); - for(int i = 1; i < values.length; i++) - if(values[i].value.length() != vectorLength) + for (int i = 1; i < values.length; i++) + if (values[i].value.length() != vectorLength) throw new IllegalArgumentException("MnemonicFamily is not of uniform vector length!"); } byText = Arrays.stream(this.values).collect(Collectors.toMap(m -> m.getText(), m -> m)); - if(values.length != byText.keySet().size()) + if (values.length != byText.keySet().size()) throw new IllegalArgumentException("MnemonicFamily contains multiple Mnemonics with the same name!"); } @@ -129,35 +129,35 @@ public class MnemonicFamily implements ParameterClassification { return values.clone(); } - + public Mnemonic get(int ordinal) { return values[ordinal]; } - + public Mnemonic get(String text) { return byText.get(text); } - + public boolean contains(Mnemonic m) { - if(m != null) + if (m != null) return m.owner == this; else return false; } - + public boolean contains(String value) { return byText.keySet().contains(value); } - + public int size() { return values.length; } - + public int getVectorLength() { return vectorLength; @@ -185,7 +185,7 @@ public class MnemonicFamily implements ParameterClassification { return stringValues.clone(); } - + @Override public int hashCode() { @@ -200,12 +200,12 @@ public class MnemonicFamily implements ParameterClassification { return this == obj; } - + @Override public Mnemonic parse(String toParse) { Mnemonic parsed = get(toParse); - if(parsed == null) + if (parsed == null) throw new UnknownMnemonicException(toParse); return parsed; } @@ -214,7 +214,7 @@ public class MnemonicFamily implements ParameterClassification { public final String name; public final BitVector value; - + public MnemonicPair(String name, BitVector value) { this.name = name; diff --git a/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/ParameterClassification.java b/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/ParameterClassification.java index 33734011..223ff423 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/ParameterClassification.java +++ b/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/ParameterClassification.java @@ -6,22 +6,23 @@ public interface ParameterClassification { /** * Determines whether a {@link MicroInstructionParameter} is part of this class of parameters. + * * @return true if the classification contains the Parameter, false otherwise */ public default boolean conforms(MicroInstructionParameter param) { return param.getType().equals(getExpectedType()) && param.getValue().length() == getExpectedBits(); } - + /** * @return The type of the parameters in this classification. */ public ParameterType getExpectedType(); - + /** * @return The number of bits of the parameters in this classification. */ public int getExpectedBits(); - + public MicroInstructionParameter parse(String toParse); } diff --git a/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/UnknownMnemonicException.java b/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/UnknownMnemonicException.java index 9b23236f..3af062e3 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/UnknownMnemonicException.java +++ b/net.mograsim.machine/src/net/mograsim/machine/mi/parameters/UnknownMnemonicException.java @@ -13,12 +13,12 @@ public class UnknownMnemonicException extends MachineException { super(); } - + public UnknownMnemonicException(String message) { super(message); } - + public UnknownMnemonicException(Throwable cause) { super(cause); diff --git a/net.mograsim.machine/src/net/mograsim/machine/standard/memory/CoreWordAddressableMemory.java b/net.mograsim.machine/src/net/mograsim/machine/standard/memory/CoreWordAddressableMemory.java index afad26ab..882b031a 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/standard/memory/CoreWordAddressableMemory.java +++ b/net.mograsim.machine/src/net/mograsim/machine/standard/memory/CoreWordAddressableMemory.java @@ -29,24 +29,29 @@ public class CoreWordAddressableMemory extends BasicCoreComponent * @param rWBit The value of the 0th bit dictates the mode: 0: Write, 1: Read * @param address The bits of this ReadEnd address the memory cell to read/write */ - public CoreWordAddressableMemory(Timeline timeline, int processTime, MainMemory memory, ReadWriteEnd data, - ReadEnd rWBit, ReadEnd address) + public CoreWordAddressableMemory(Timeline timeline, int processTime, MainMemory memory, ReadWriteEnd data, ReadEnd rWBit, + ReadEnd address) { super(timeline, processTime); MainMemoryDefinition definition = memory.getDefinition(); - if(data.width() != definition.getCellWidth()) - throw new IllegalArgumentException(String.format("Bit width of data wire does not match main memory definition. Expected: %d Actual: %d", definition.getCellWidth(), data.width())); - if(rWBit.width() != 1) - throw new IllegalArgumentException(String.format("Bit width of read/write mode select wire is unexpected. Expected: 1 Actual: %d", rWBit.width())); - if(address.width() != definition.getMemoryAddressBits()) - throw new IllegalArgumentException(String.format("Bit width of address wire does not match main memory definition. Expected: %d Actual: %d", definition.getMemoryAddressBits(), address.width())); + if (data.width() != definition.getCellWidth()) + throw new IllegalArgumentException( + String.format("Bit width of data wire does not match main memory definition. Expected: %d Actual: %d", + definition.getCellWidth(), data.width())); + if (rWBit.width() != 1) + throw new IllegalArgumentException( + String.format("Bit width of read/write mode select wire is unexpected. Expected: 1 Actual: %d", rWBit.width())); + if (address.width() != definition.getMemoryAddressBits()) + throw new IllegalArgumentException( + String.format("Bit width of address wire does not match main memory definition. Expected: %d Actual: %d", + definition.getMemoryAddressBits(), address.width())); this.data = data; this.rWBit = rWBit; this.address = address; data.registerObserver(this); rWBit.registerObserver(this); address.registerObserver(this); - + this.memory = memory; } @@ -56,7 +61,7 @@ public class CoreWordAddressableMemory extends BasicCoreComponent if (!address.hasNumericValue()) { if (read.equals(rWBit.getValue())) - return e -> data.feedSignals(Bit.U.toVector(data.width()));//TODO don't always feed U, but decide to feed X or U. + return e -> data.feedSignals(Bit.U.toVector(data.width()));// TODO don't always feed U, but decide to feed X or U. return e -> data.clearSignals(); } long addressed = address.getUnsignedValue(); @@ -64,8 +69,7 @@ public class CoreWordAddressableMemory extends BasicCoreComponent { BitVector storedData = memory.getCell(addressed); return e -> data.feedSignals(storedData); - } - else + } else { BitVector transData = data.getValues(); return e -> diff --git a/net.mograsim.machine/src/net/mograsim/machine/standard/memory/MemoryException.java b/net.mograsim.machine/src/net/mograsim/machine/standard/memory/MemoryException.java index c0a78896..5183e323 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/standard/memory/MemoryException.java +++ b/net.mograsim.machine/src/net/mograsim/machine/standard/memory/MemoryException.java @@ -14,12 +14,12 @@ public class MemoryException extends MachineException { super(); } - + public MemoryException(String message) { super(message); } - + public MemoryException(Throwable cause) { super(cause); diff --git a/net.mograsim.machine/src/net/mograsim/machine/standard/memory/ModelWordAddressableMemory.java b/net.mograsim.machine/src/net/mograsim/machine/standard/memory/ModelWordAddressableMemory.java index 99cc78d4..807c1281 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/standard/memory/ModelWordAddressableMemory.java +++ b/net.mograsim.machine/src/net/mograsim/machine/standard/memory/ModelWordAddressableMemory.java @@ -16,14 +16,14 @@ public abstract class ModelWordAddressableMemory extends ModelMemory { super(model, 120, 150, name, "RAM", false); this.definition = definition; - + addPin(addrPin = new Pin(model, this, "A", definition.getMemoryAddressBits(), PinUsage.INPUT, getWidth(), 30)); addPin(dataPin = new Pin(model, this, "D", definition.getCellWidth(), PinUsage.TRISTATE, getWidth(), 50)); addPin(rWPin = new Pin(model, this, "RW", 1, PinUsage.INPUT, getWidth(), 70)); init(); } - + public MainMemoryDefinition getDefinition() { return definition; diff --git a/net.mograsim.machine/src/net/mograsim/machine/standard/memory/WordAddressableMemory.java b/net.mograsim.machine/src/net/mograsim/machine/standard/memory/WordAddressableMemory.java index 3dddc2ed..4a54ad9f 100644 --- a/net.mograsim.machine/src/net/mograsim/machine/standard/memory/WordAddressableMemory.java +++ b/net.mograsim.machine/src/net/mograsim/machine/standard/memory/WordAddressableMemory.java @@ -26,7 +26,7 @@ public class WordAddressableMemory extends GenericMemory implements M BitVector data = super.getCell(address); return data == null ? BitVector.of(Bit.ZERO, cellWidth) : data; } - + @Override public BigInteger getCellAsBigInteger(long address) { diff --git a/net.mograsim.machine/test/net/mograsim/machine/standard/memory/WordAddressableMemoryTest.java b/net.mograsim.machine/test/net/mograsim/machine/standard/memory/WordAddressableMemoryTest.java index 7b50d120..5adfc253 100644 --- a/net.mograsim.machine/test/net/mograsim/machine/standard/memory/WordAddressableMemoryTest.java +++ b/net.mograsim.machine/test/net/mograsim/machine/standard/memory/WordAddressableMemoryTest.java @@ -14,8 +14,9 @@ import net.mograsim.logic.core.wires.CoreWire; import net.mograsim.logic.core.wires.CoreWire.ReadWriteEnd; import net.mograsim.machine.MainMemoryDefinition; -class WordAddressableMemoryTest { - +class WordAddressableMemoryTest +{ + private Timeline t = new Timeline(10); @Test @@ -29,9 +30,10 @@ class WordAddressableMemoryTest { ReadWriteEnd addressI = address.createReadWriteEnd(); @SuppressWarnings("unused") - CoreWordAddressableMemory memory = new CoreWordAddressableMemory(t, 4, new WordAddressableMemory(MainMemoryDefinition.create(64, 16, 4096L, Long.MAX_VALUE)), data.createReadWriteEnd(), + CoreWordAddressableMemory memory = new CoreWordAddressableMemory(t, 4, + new WordAddressableMemory(MainMemoryDefinition.create(64, 16, 4096L, Long.MAX_VALUE)), data.createReadWriteEnd(), rW.createReadOnlyEnd(), address.createReadOnlyEnd()); - + Random r = new Random(); for (long j = 1; j > 0; j *= 2) { -- 2.17.1