Download as pdf or txt
Download as pdf or txt
You are on page 1of 17

External Project Report on

Computer Organization and Architecture


(EET 2211)

Design a Unit Converter


using ARM32 assembly
language

Submitted by

Name – Aryan Raj Reg. No. 2241018014


Name – Nikhil Kumar Reg. No. 2241011149

B. Tech. CSE 4th Semester (Section – 42)

i
Declaration

We, the undersigned students of B. Tech. of Computer Science


Engineering Department hereby declare that we own the full
responsibility for the information, results etc. provided in this
PROJECT titled “Design A Unit Converter Using ARM32
Assembly Language” submitted to Siksha ‘O’ Anusandhan
Deemed to be University, Bhubaneswar for the partial
fulfillment of the subject Computer Organization and
Architecture (EET 2211). We have taken care in all respect to
honor the intellectual property right and have acknowledged the
contribution of others for using them in academic purpose and
further declare that in case of any violation of intellectual
property right or copyright we, as the candidate(s), will be fully
responsible for the same.

ARYAN RAJ NIKHIL KUMAR


Registration No. - 2241018014 Registration No. - 2241011149

DATE : 21/05/2024

ii
PLACE : BHUBANESWAR

Abstract

This project involves the design and implementation of a


scientific calculator using ARM32 assembly language. The
calculator will be capable of performing complex
mathematical computations such as trigonometric
functions, logarithms, exponentiation, and more. The
assembly language will be utilized to directly interface
with the ARM processor, optimizing performance and
resource usage. The project aims to demonstrate
proficiency in low-level programming, understanding of
processor architecture, and application of mathematical
algorithms. Key components include user interface design,
algorithm implementation, and testing on ARM-based
hardware.

iii
Contents

Serial Chapter Title of the Chapter Page


No. No. No.

1. 1 Introduction 1

2. 2 Problem Statement 2

3. 3 Methodology 4

4. 4 Implementation 5

5. 5 Results and interpretation 10

6. 6 Conclusion 11

7. 7. References 12

8. 8. Appendices 13

iv
1. Introduction

In our daily lives, the ability to accurately convert between units


of measurement is essential. This project delves into designing
and implementing a unit converter program specifically tailored
for ARM32 assembly language, focusing on unit converter

ARM processors are prevalent in a wide range of devices we use


daily, from smartphones and tablets to microcontrollers and
embedded systems. Developing a unit converter in ARM32
assembly offers unique benefits. Assembly language provides us
with granular control over hardware, enabling highly optimized
and efficient code. This is crucial for resource-constrained
embedded systems where power consumption and processing
speed are paramount concerns. Additionally, assembly language
programs tend to be compact, making them ideal for devices with
limited memory resources.

The subsequent sections of this report will explore the project's


problem statement in detail, outlining the chosen methodology
and implementation specifics. We will analyze the achieved
results and explore their interpretation, ultimately drawing
conclusions about the project's effectiveness. Additionally,
references and appendices will be provided for further
exploration and understanding.

1
2. Problem Statement

You are tasked with designing a unit converter program for an


ARM32-based microcontroller. The program should allow users
to convert between various units of measurement, including
length, temperature, weight, and volume.

Requirements:

1. Supported Units: The unit converter should support


conversion 1 between the following units:

● Length: meters (m), centimeters (cm), inches (in), feet (ft)


● Temperature: Celsius (°C), Fahrenheit (°F)
● Weight: kilograms (kg), grams (g), pounds (lb)
● Volume: liters (L), millilitres (mL), gallons (gal)

2. Conversion Operations: Users should be able to perform the


following conversion operations:

● Convert between any supported units within the same


measurement type (e.g., meters to feet, Celsius to Fahrenheit).
● Perform arithmetic operations (addition, subtraction,
multiplication, division) on values in the same unit type (e.g., add
5 meters to 10 meters).

3. User Interface: The program should have a simple command-


line interface (CLI) allowing users to input their conversion
requests and see the results.

4. Error Handling: Implement appropriate error handling


mechanisms to handle invalid inputs (e.g., non-numeric input,
division by zero) and provide meaningful error messages to the
user.

2
Design Constraints:

1. Use ARM32 assembly language for implementation.


2. Optimize the program for memory usage and execution speed.
3. Ensure the program runs efficiently on the target
microcontroller hardware.

Deliverables:

1. ARM32 assembly language source code implementing the unit


converter program.

2. Documentation explaining the design, implementation, and


usage of the program.
3. Test cases and test results demonstrating the correctness and
robustness of the program.

3
3. Methodology

1. Define Requirements: Clearly define the requirements of your unit


converter. What units will it support? What operations will it perform (e.g.,
conversion between units, arithmetic operations on units)?

2. Choose a Development Environment: Select an ARM32 assembly


language development environment. Options include Keil µVision, GNU
toolchain, or ARM Development Studio.

3. Design the User Interface: Decide on the user interface. This could be a
command-line interface (CLI), a graphical user interface (GUI), or even a
web interface if you're planning to integrate it into a larger system.

4. Implement Conversion Algorithms: Write algorithms in ARM32


assembly language to perform the required unit conversions. This involves
understanding the mathematical formulas for converting between different
units (e.g., Celsius to Fahrenheit, meters to feet).

5. Error Handling: Implement error handling mechanisms to handle


invalid inputs or edge cases (e.g., division by zero, out-of-range inputs).

6. Testing: Test your unit converter thoroughly to ensure it behaves as


expected under various scenarios and input conditions. This may involve
writing test cases and using both normal and boundary inputs.

7. Optimization: Optimize your code for performance and efficiency,


considering 3 constraints such as memory usage and execution speed on
ARM architecture.

8. Documentation: Document your code thoroughly, including comments


to explain the purpose of each section and how it works. This will make it
easier for others (and yourself) to understand and maintain the code in the
future. 9. Deployment: Once your unit converter is complete and tested,
deploy it in your desired environment (e.g., as a standalone application,
integrated into a larger system). 10. Maintenance and Updates: Monitor
and maintain your unit converter over time, fixing any bugs that arise and
updating it as needed to support new units or features.

4
4. Implementation

The implementation phase involves writing and testing the


assembly code modules for each component:

● Input Handling: Capture user input and convert it into


actionable commands.

● Arithmetic Operations: Implement two basic shift operations


LSL(Logical Shift Left ) and LSR(Logical Shift Right) using ARM32
instructions.

● Scientific Functions: Develop conversion from kilometer to


meter , meter to centimeter , centimeter to millimeter and vice
versa.

● Memory Management: Utilize ARM32 memory 4 instructions


to manage dynamic memory allocation and deallocation.

● Error Handling: Implement routines to check for and handle


errors during execution.

5
6
Assembly Code :

.global _start

_start:

@UNIT CONVERTER

@LENGTH

@converting kilometer to meters

MOV R1, #5 @R1 contains the value in kilometers (5 km

in this example)

MOV R3, #1000 @Load the value 1000 into register R3

MUL R2, R1, R3 @Multiply the value in R1 by the value

in R3,

store the result in R2

@Converting to centimeters

MOV R4, R2

MOV R5, #100

MUL R4, R4, R5

7
@Conversion to millimeters

MOV R6, R4

MOV R7, #100

MUL R6, R6, R7

@QUANTITY

@converting litres to millilitres

@Convert from litres to centiliters

MOV R9, #7

MOV R10, #100

MUL R9, R9, R10

@Convert from millilitres to centilitres

MOV R11, R9

MOV R12, #10

MUL R11, R11, R12

8
.global _start

_start:

@Convert from litres to milliliters

MOV R0, #7

MOV R1,

@Convert from millilitres to litres

MOV R2, #1000

LSR R3, R2, #10

9
5. Results & Interpretation

The unit converter application will be tested for functionality


and performance.

● Verification of correct mathematical calculations for basic


length conversion with appropriate calculation

● User interaction testing to ensure a beneficial and intuitive


interface.

10
6. Conclusion

In conclusion, this project demonstrates the feasibility of implementing


a unit converter using ARM32 assembly language.

By leveraging the capabilities of ARM32 architecture, we have


successfully created a functional converter that performs a range of
mathematical conversion efficiently.

The project highlights the importance of low-level programming skills


and provides insights into memory management and optimization in
assembly language programming.

This structured approach outlines the key aspects of designing and


implementing a unit converter using ARM32 assembly language.

Each section focuses on specific tasks and challenges involved in the


project, ultimately leading to the development of a fully unit converter
application.

1
7. References

[1] ARM Limited. (2019). "ARM Architecture Reference Manual ARMv7-A


and ARMv7-R Edition." ARM DDI 0406 C.b.

[2] Furber, S. (2012). "ARM System-on-Chip Architecture." Pearson


Education.

[3] Irvine, K. (2016). "ARM Assembly Language: Fundamentals and


Techniques." CRC Press.

[4] Aggarwal, A., & Garg, R. (2015). "Introduction to ARM Cortex-M


Microcontrollers." Springer.

[5] "GNU Assembler (GAS) Documentation." (n.d.). Retrieved from


https://sourceware.org/binutils/docs/as/.

2
8. Appendices

Appendix A: ARM Instruction Set Quick Reference Guide - A concise


overview of ARM32 assembly instructions and their functionalities.

Appendix B: Calculator Function Specifications - Detailed description of


mathematical functions to be implemented, including trigonometric,
logarithmic, and exponential operations.

Appendix C: Hardware and Software Requirements - List of required ARM


development tools, hardware 11 components, and software dependencies.

Appendix D: Code Listings - Sample code snippets demonstrating key


algorithms and implementation techniques for the scientific calculator.

Appendix E: Testing and Validation Plan - Outline of testing procedures and


criteria to ensure the accuracy and reliability of the calculator.

These appendices provide supplemental information essential for


understanding and implementing the scientific calculator project using
ARM32 assembly language.

You might also like