Microsoft Word - Lab2.docx Lab #2 CoSc 20203 Fall 2021 ARM Machine Instructions Due: Thursday Sept 30 Midnight DESCRIPTION From Wikipedia: “ARM, previously Advanced RISC Machine, originally Acorn RISC...

1 answer below »
Please see the attached pdf


Microsoft Word - Lab2.docx Lab #2 CoSc 20203 Fall 2021 ARM Machine Instructions Due: Thursday Sept 30 Midnight DESCRIPTION From Wikipedia: “ARM, previously Advanced RISC Machine, originally Acorn RISC Machine, is a family of reduced instruction set computing (RISC) architectures for computer processors, configured for various environments. Processors that have a RISC architecture typically require fewer transistors than those with a complex instruction set computing (CISC) architecture (such as the x86 processors found in most personal computers), which improves cost, power consumption, and heat dissipation. These characteristics are desirable for light, portable, battery-powered devices—including smartphones, laptops and tablet computers, and other embedded systems.” We will deal with a very small set of the arm instruction set, basically we interested in generating the instruction hardware code for data processing instructions such as: ADD r0,r1,r2; add r1 to r2 and put the result in r0 That instruction tells the CPU to add a “word” (32-bit) value from data register 0 to the value in data register1 and put the results in r2. In machine language, the instruction looks like E0810002 in Hexadecimal or in Binary For this we need to understand the instruction hardware format for the 32 bit ARM7 which is as follows For the instructions that we will implement the condition, I, S, Shift (size and op) and ST bits are predefined as follows: The codes of the instructions that we will be only the following ones: Sources: http://vision.gel.ulaval.ca/~jflalonde/cours/1001/h17/docs/arm- instructionset.pdf https://en.wikipedia.org/wiki/ARM_architecture Images of ARM chip based devices may be located at https://duckduckgo.com/?q=ARM+chip+based+devices+&t=h_&iax=images&ia=images ASSIGNMENT Write a Java application with a graphical user interface that allows a user to encode and decode the sixteen ARM7 instructions described above for sixteen registers. The program must provide the following functionalities • Conversions should be done from Assembler Mnemonics to Assembler Code and vice versa. • Upper and lowercase are accepted and represent the same instruction • Generate the message of errors if the input cannot be translated (i.e. encoded/decoded) • Display JTextFields with the instructions encoded in both binary and hexadecimal during session should be provided • Exception handling for checked and unchecked exceptions must be provided The design of the interface is left to you. A Zip file with this requirements (i.e. screenshots, manual, jar, javadoc, src) should be submitted using D2L. You should use appropriate widgets to allow the user to enter a four digit hex number and request that it be decoded into assembly language or enter an assembly(in binary) language instruction and request that it be encoded into hex representation. Your program needs to encode/decode only the sixteen instructions shown above. Here is an initial visual guide on the final product. Note that your task is only the software translation (i.e. encoding/decoding) and not the hardware execution of the instructions. This is a string processing application, so in order to complete this project you must use the StringTokenizer class, substrings and testing characters in a String as we have seem in in class. And do remember to document each method and generate a clickable jar that should be submitted along with the java sources and the javadoc. Exceptions must be caught using try/catch in the model or in the control with the corresponding throws in the model method. IMPORTANT NOTE. The example present is just an example, the functionality and performance are important results to display Thebasicinterface Enteringacorrectmnemonicinstruction AftertheEncodebuttonisentered Enteringacorrecthexacode AftertheDecodeHexisentered Enteringacorrectbinaryinstructioncode(32bits) AftertheDecodeBinaryisentered IMPORTANT:Whenwrongcodesareenteredthereshouldbemessagesreportedto theuser,forexample
Answered 1 days AfterSep 28, 2021

Answer To: Microsoft Word - Lab2.docx Lab #2 CoSc 20203 Fall 2021 ARM Machine Instructions Due: Thursday Sept...

Ramachandran answered on Sep 30 2021
142 Votes
Order-92301/jar/ARM.jar
META-INF/MANIFEST.MF
Manifest-Version: 1.0
Main-Class: com.arm.Application
com/arm/Application.class
package com.arm;
public synchronized class Application {
private static javax.swing.JTextField instructionTextField;
private static ArmEncoder armEncoder;
private static javax.swing.JLabel errorLabel;
private static javax.swing.JTextField hexInstructionTextField;
private static javax.swing.JTextField binaryInstructionTextField;
public void Application();
public static void main(String[]);
private static java.awt.event.ActionListener binaryDecodeButtonActionListener();
private static java.awt.event.ActionListener hexDecodeButtonActionListener();
private static java.awt.event.ActionListener encodeButtonActionListener();
static javax.swing.JTextField createTextField(int, String);
static javax.swing.JLabel createLabel(int, String);
static javax.swing.JButton createButton(int, String);
}
com/arm/ArmEncoder$1.class
package com.arm;
final synchronized class ArmEncoder$1 extends java.util.HashMap {
void ArmEncoder$1();
}
com/arm/ArmEncoder$Type.class
package com.arm;
final synchronized enum ArmEncoder$Type {
public static final ArmEncoder$Type HEX;
public static final ArmEncoder$Type BINARY;
public static ArmEncoder$Type[] values();
public static ArmEncoder$Type valueOf(String);
private void ArmEncoder$Type(String, int);
static void ();
}
com/arm/ArmEncoder.class
package com.arm;
public synchronized class ArmEncoder {
private static final int ARM_INSTRUCTION_LENGTH = 32;
private static final String ADD = ADD;
private static final String AND = AND;
private static final String EOR = EOR;
private static final String SUB = SUB;
private static final String RSB = RSB;
private static final String ADC = ADC;
private static final String SBC = SBC;
private static final String RSC = RSC;
private static final String TST = TST;
private static final String TEQ = TEQ;
private static final String CMP = CMP;
private static final String CMN = CMN;
private static final String ORR = ORR;
private static final String MOV = MOV;
private static final String BIC = BIC;
private static final String MVN = MVN;
private static final java.util.Map OPERATOR_CODE_MAP;
public void ArmEncoder();
public String encode(String) throws Exception;
public String decode(String, ArmEncoder$Type) throws Exception;
public String convertHexToBinary(String) throws Exception;
public String convertBinaryToHex(String) throws Exception;
private String buildInstruction(String, String, String, String);
private String parseRegisterBinary(String) throws Exception;
private String parseRegisterString(String) throws Exception;
private String findOperatorByCode(String) throws Exception;
private String findOperatorByName(String) throws Exception;
static void ();
}
com/arm/ImagePanel.class
package com.arm;
synchronized class ImagePanel extends javax.swing.JPanel {
private final java.awt.Image img;
public void ImagePanel(String);
public void ImagePanel(java.awt.Image);
public void paintComponent(java.awt.Graphics);
}
images/background.jpg
Order-92301/javadoc/allclasses-frame.html
All Classes
        Application
        ArmEncoder
Order-92301/javadoc/allclasses-noframe.html
All Classes
        Application
        ArmEncoder
Order-92301/javadoc/com/arm/Application.html
JavaScript is disabled on your browser.
Skip navigation links
        Package
        Class
        Tree
        Deprecated
        Index
        Help
        Prev Class
        Next Class
        Frames
        No Frames
        All Classes
        Summary: 
        Nested | 
        Field | 
        Constr | 
        Method
        Detail: 
        Field | 
        Constr | 
        Method
com.arm
Class Application
        java.lang.Object
        
        com.arm.Application
        
public class Application
extends java.lang.Object
Main Class which creates the application.
        
        
Constructor Summary
Constructors         Constructor and Description
        Application() 
        
Method Summary
All Methods Static Methods Concrete Methods         Modifier and Type        Method and Description
        static void        main(java.lang.String[] args)
Program execution begins from this method.
        
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
        
        
Constructor Detail
        
Application
public Application()
        
Method Detail
        
main
public static void main(java.lang.String[] args)
Program execution begins from this method.
This method creates and manages the GUI
        Parameters:
        args - external arguments
Skip navigation links
        Package
        Class
        Tree
        Deprecated
        Index
        Help
        Prev Class
        Next Class
        Frames
        No Frames
        All Classes
        Summary: 
        Nested | 
        Field | 
        Constr | 
        Method
        Detail: 
        Field | 
        Constr | 
        Method
Order-92301/javadoc/com/arm/ArmEncoder.html
JavaScript is disabled on your browser.
Skip navigation links
        Package
        Class
        Tree
        Deprecated
        Index
        Help
        Prev Class
        Next Class
        Frames
        No Frames
        All Classes
        Summary: 
        Nested | 
        Field | 
        Constr | 
        Method
        Detail: 
        Field | 
        Constr | 
        Method
com.arm
Class ArmEncoder
        java.lang.Object
        
        com.arm.ArmEncoder
        
public class ArmEncoder
extends java.lang.Object
Class used to encode and decode an ARM Instruction
        
        
Constructor Summary
Constructors         Constructor and Description
        ArmEncoder() 
        
Method Summary
All Methods Instance Methods Concrete Methods         Modifier and Type        Method and Description
        java.lang.String        convertBinaryToHex(java.lang.String binary)
method to convert binary string to hex string
        java.lang.String        convertHexToBinary(java.lang.String hex)
method to convert hex string to a binary string
        java.lang.String        decode(java.lang.String input,
com.arm.ArmEncoder.Type type)
method to decode the 32 bit ARM instruction set
0-6 - 7 bits hardcoded [1110000]
7-10 - 4 bits opcode
11-11 - 1 bits hardcoded [0]
12-15 - 4 bits op 1 reg
16-19 - 4 bits dest reg
20-27 - 8 bits hardcoded [00000000]
28-31 - 4 bits op 2reg
        java.lang.String        encode(java.lang.String input)
method to encode an input arm instruction
        
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
        
        
Constructor Detail
        
ArmEncoder
public ArmEncoder()
        
Method Detail
        
encode
public java.lang.String encode(java.lang.String input)
throws java.lang.Exception
method to encode an input arm instruction
        Parameters:
        input - arm instruction
        Returns:
        32 bit ARM binary instruction set
        Throws:
        java.lang.Exception - if unable to encode, exception message contains reason
        
decode
public java.lang.String decode(java.lang.String input,
com.arm.ArmEncoder.Type type)
throws java.lang.Exception
method to decode the 32 bit ARM instruction set
0-6 - 7 bits hardcoded [1110000]
7-10 - 4 bits opcode
11-11 - 1 bits hardcoded [0]
12-15 - 4 bits op 1 reg
16-19 - 4 bits dest reg
20-27 - 8 bits hardcoded [00000000]
28-31 - 4 bits op 2reg
        Parameters:
        input - instruction set
        type - representation of the input (HEX, BINARY)
        Returns:
        decoded instruction
        Throws:
        java.lang.Exception - if unable to decode, exception message contains reason
        
convertHexToBinary
public java.lang.String convertHexToBinary(java.lang.String hex)
throws java.lang.Exception
method to convert hex string to a binary string
        Parameters:
        hex - hex string
        Returns:
        binary string
        Throws:
        java.lang.Exception
        
convertBinaryToHex
public java.lang.String convertBinaryToHex(java.lang.String binary)
throws java.lang.Exception
method to convert binary string to hex string
        Parameters:
        binary - binary string
        Returns:
        hex string
        Throws:
        java.lang.Exception
Skip navigation links
        Package
        Class
        Tree
        Deprecated
        Index
        Help
        Prev Class
        Next Class
        Frames
        No Frames
        All Classes
        Summary: 
        Nested | 
        Field | 
        Constr | 
        Method
        Detail: 
        Field | 
        Constr | 
        Method
Order-92301/javadoc/com/arm/package-frame.html
com.arm
Classes
        Application
        ArmEncoder
Order-92301/javadoc/com/arm/package-summary.html
JavaScript is disabled on your browser.
Skip navigation links
        Package
        Class
        Tree
        Deprecated
        Index
        Help
        Prev Package
        Next Package
        Frames
        No Frames
        All Classes
Package com.arm
        
Class Summary         Class        Description
        Application        
Main Class which creates the application.
        ArmEncoder        
Class used to encode and decode an ARM Instruction
Skip navigation links
        Package
        Class
        Tree
        Deprecated
        Index
        Help
        Prev Package
        Next Package
        Frames
        No Frames
        All Classes
Order-92301/javadoc/com/arm/package-tree.html
JavaScript is disabled on your browser.
Skip navigation links
        Package
        Class
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
Hierarchy For Package com.arm
Class Hierarchy
        java.lang.Object
        com.arm.Application
        com.arm.ArmEncoder
Skip navigation links
        Package
        Class
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
Order-92301/javadoc/constant-values.html
JavaScript is disabled on your browser.
Skip navigation links
        Package
        Class
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
Constant Field Values
Contents
Skip navigation links
        Package
        Class
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
Order-92301/javadoc/deprecated-list.html
JavaScript is disabled on your browser.
Skip navigation links
        Package
        Class
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
Deprecated API
Contents
Skip navigation links
        Package
        Class
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
Order-92301/javadoc/help-doc.html
JavaScript is disabled on your browser.
Skip navigation links
        Package
        Class
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
How This API Document Is Organized
This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.
        
Package
Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
        Interfaces (italic)
        Classes
        Enums
        Exceptions
        Errors
        Annotation Types
        
Class/Interface
Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:
        Class inheritance diagram
        Direct Subclasses
        All Known Subinterfaces
        All Known Implementing Classes
        Class/interface declaration
        Class/interface description
        Nested Class Summary
        Field Summary
        Constructor Summary
        Method Summary
        Field Detail
        Constructor Detail
        Method Detail
Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
        
Annotation Type
Each annotation type has its own separate page with the following sections:
        Annotation Type declaration
        Annotation Type description
        Required Element Summary
        Optional Element Summary
        Element Detail
        
Enum
Each enum has its own separate page with the following sections:
        Enum declaration
        Enum description
        Enum Constant Summary
        Enum Constant Detail
        
Tree (Class Hierarchy)
There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
        When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
        When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
        
Deprecated API
The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
        
Index
The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
        
Prev/Next
These links take you to the next or previous class, interface, package, or related page.
        
Frames/No Frames
These links show and hide the HTML frames. All pages are available with or without frames.
        
All Classes
The All Classes link shows all classes and interfaces except non-static nested types.
        
Serialized Form
Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description.
        
Constant Field Values
The Constant Field Values page lists the static final fields and their values.
This help file applies to API documentation generated using the standard doclet.
Skip navigation links
        Package
        Class
        Tree
        Deprecated
        Index
        Help
        Prev
        Next
        Frames
        No Frames
        All Classes
Order-92301/javadoc/index.html
Order-92301/javadoc/index-files/index-1.html
JavaScript is disabled on your browser.
Skip navigation links
        Package
        Class
        Tree
        Deprecated
        Index
        Help
        Prev Letter
        Next Letter
        Frames
        No Frames
        All Classes
A C D E M 
A
        Application - Class in com.arm
        
Main Class which creates the application.
        Application() - Constructor for class com.arm.Application
         
        ArmEncoder - Class in com.arm
        
Class used to encode and decode an ARM Instruction
        ArmEncoder() - Constructor for class com.arm.ArmEncoder
         
A C D E M 
Skip navigation links
        Package
        Class
        Tree
        Deprecated
        Index
        Help
        Prev Letter
        Next Letter
        Frames
        No Frames
        All Classes
Order-92301/javadoc/index-files/index-2.html
JavaScript is disabled on your browser.
Skip navigation links
        Package
        Class
        Tree
        Deprecated
        Index
        Help
        Prev Letter
        Next Letter
        Frames
        No Frames
        All Classes
A C D E M 
C
        com.arm - package com.arm
         
        convertBinaryToHex(String) - Method in class com.arm.ArmEncoder
        
method to convert binary string to hex string
        convertHexToBinary(String) - Method in class...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here