SlideShare a Scribd company logo
1 of 2
Download to read offline
Assignment 2: 20 points
EE 337: Microprocessors Laboratory (Spring 2022)
Indian Institute of Technology Bombay
Date: January 18, 2022
1. [5 points] Write an assembly language program to add two 16-bit numbers x and
y. Use the following program as a starting point. Add your code in the ADD16
subroutine.
// -- DO NOT CHANGE ANYTHING UNTIL THE **** LINE--//
ORG 0H
LJMP MAIN
ORG 100H
MAIN:
CALL ADD16
HERE: SJMP HERE
ORG 130H
// *****************
ADD16:
// ADD YOUR CODE HERE
RET
END
ˆ The number x is stored at locations 70H and 71H, with its most significant byte
(MSB) in 70H and the least significant byte in 71H.
ˆ The number y is stored at locations 72H (MSB) and 73H (LSB).
ˆ Since the result z = x + y can be 17 bits long, store the result in memory
locations 74H, 75H, 76H.
ˆ For z = z16z15z14 . . . z3z2z1z0 where z0 is the least significant bit and z16 is
the most significant bit, the memory location 74H should have 0000000z16, the
memory location 75H should have the bits z15z14 . . . z8, and the memory location
76H should have the bits z7z6 . . . z0.
2. [15 points] In a fully connected neural network, forward propagation involves the
Multiply and Accumulate (MAC) operation. The neuron input is multiplied with the
weight attributed to the path between that neuron and the neuron to the next layer.
Then, all such products coming from different source neurons to the same destination
neuron are added.
Let us consider the neuron inputs to be a1, a2, a3. Let the corresponding weights be
b1, b2, b3. The result after the MAC operation will be
x = a1b1 + a2b2 + a3b3.
Write an assembly language program to generate the result x, when a1, a2, a3 are
three 8-bit neuron inputs present in the memory locations 70H to 72H and b1, b2, b3
are 8-bit weights present in the memory locations 73H to 75H.
Since the result x can be 18 bits long, store the result in memory locations 50H,
51H, 52H. For x = x17x16x15 . . . x3x2x1x0, the memory location 50H should have
000000x17x16, the memory location 51H should have the bits x15x14 . . . x8, and the
memory location 52H should have the bits x7x6 . . . x0.
Use the following program as a starting point. Use the ADD16 subroutine written in
the previous question to implement the MAC operation.
// -- DO NOT CHANGE ANYTHING UNTIL THE **** LINE--//
ORG 0H
LJMP MAIN
ORG 100H
MAIN:
CALL MAC
HERE: SJMP HERE
ORG 130H
// *****************
MAC:
// MAC OPERATION, CALL THE ADDITION SUBROUTINE USING "CALL ADD16"
RET
ADD16:
//16 BIT ADDITION CODE
RET
END
TA Checkpoints
1. For question 1, check the following two cases:
ˆ x = 1234H, y = DCBAH.
ˆ x = FFFFH, y = FFFFH.
2. For question 2, check the following three cases:
ˆ a1, a2, a3 = 18H, 24H, 0CH, b1, b2, b3 = 03H, 02H, 06H.
ˆ a1, a2, a3 = FFH, FFH, 01H, b1, b2, b3 = FFH, FFH, FFH.
ˆ a1, a2, a3 = FFH, FFH, FFH, b1, b2, b3 = FFH, FFH, FFH.
3. For question 2, ask the student to explain the code in the MAC subroutine.

More Related Content

What's hot

A10 microprocessor & microcontrollers ( eee, ece & ecm )
A10 microprocessor & microcontrollers ( eee, ece & ecm )A10 microprocessor & microcontrollers ( eee, ece & ecm )
A10 microprocessor & microcontrollers ( eee, ece & ecm )
Abhinay Potlabathini
 

What's hot (20)

Lab8 s2
Lab8 s2Lab8 s2
Lab8 s2
 
Lab4 s2
Lab4 s2Lab4 s2
Lab4 s2
 
Lab3 s2
Lab3 s2Lab3 s2
Lab3 s2
 
Basics of c
Basics of cBasics of c
Basics of c
 
Functions of stdio conio
Functions of stdio   conio Functions of stdio   conio
Functions of stdio conio
 
My first program in c, hello world !
My first program in c, hello world !My first program in c, hello world !
My first program in c, hello world !
 
Lecture 06 assembler
Lecture 06 assemblerLecture 06 assembler
Lecture 06 assembler
 
C program to write c program without using main function
C program to write c program without using main functionC program to write c program without using main function
C program to write c program without using main function
 
Lab5 s1
Lab5 s1Lab5 s1
Lab5 s1
 
A10 microprocessor & microcontrollers ( eee, ece & ecm )
A10 microprocessor & microcontrollers ( eee, ece & ecm )A10 microprocessor & microcontrollers ( eee, ece & ecm )
A10 microprocessor & microcontrollers ( eee, ece & ecm )
 
Embedded programming u3 part 1
Embedded programming u3 part 1Embedded programming u3 part 1
Embedded programming u3 part 1
 
Computer architecture
Computer architectureComputer architecture
Computer architecture
 
nand2tetris 舊版投影片 -- 第三章 循序邏輯
nand2tetris 舊版投影片 -- 第三章 循序邏輯nand2tetris 舊版投影片 -- 第三章 循序邏輯
nand2tetris 舊版投影片 -- 第三章 循序邏輯
 
8051 programming skills using EMBEDDED C
8051 programming skills using EMBEDDED C8051 programming skills using EMBEDDED C
8051 programming skills using EMBEDDED C
 
Dead Code Elimination
Dead Code EliminationDead Code Elimination
Dead Code Elimination
 
nand2tetris 舊版投影片 -- 第四章 機器語言
nand2tetris 舊版投影片 -- 第四章 機器語言nand2tetris 舊版投影片 -- 第四章 機器語言
nand2tetris 舊版投影片 -- 第四章 機器語言
 
Common Programming Errors
Common Programming ErrorsCommon Programming Errors
Common Programming Errors
 
Lab6 s1
Lab6 s1Lab6 s1
Lab6 s1
 
Ivan mamontov and Mikhail Khuldnev Present : Fast Decompression Lucene Codec
Ivan mamontov and Mikhail Khuldnev Present : Fast Decompression Lucene CodecIvan mamontov and Mikhail Khuldnev Present : Fast Decompression Lucene Codec
Ivan mamontov and Mikhail Khuldnev Present : Fast Decompression Lucene Codec
 
Code optimization
Code optimizationCode optimization
Code optimization
 

Similar to Lab2 of EE337 Microprocessors Lab, 2022, IIT Bombay

Similar to Lab2 of EE337 Microprocessors Lab, 2022, IIT Bombay (20)

GSP 215 RANK Become Exceptional--gsp215rank.com
GSP 215 RANK Become Exceptional--gsp215rank.comGSP 215 RANK Become Exceptional--gsp215rank.com
GSP 215 RANK Become Exceptional--gsp215rank.com
 
GSP 215 RANK Achievement Education--gsp215rank.com
GSP 215 RANK Achievement Education--gsp215rank.comGSP 215 RANK Achievement Education--gsp215rank.com
GSP 215 RANK Achievement Education--gsp215rank.com
 
Gsp 215 Effective Communication / snaptutorial.com
Gsp 215  Effective Communication / snaptutorial.comGsp 215  Effective Communication / snaptutorial.com
Gsp 215 Effective Communication / snaptutorial.com
 
Gsp 215 Future Our Mission/newtonhelp.com
Gsp 215 Future Our Mission/newtonhelp.comGsp 215 Future Our Mission/newtonhelp.com
Gsp 215 Future Our Mission/newtonhelp.com
 
GSP 215 Doing by learn/newtonhelp.com
GSP 215 Doing by learn/newtonhelp.comGSP 215 Doing by learn/newtonhelp.com
GSP 215 Doing by learn/newtonhelp.com
 
GSP 215 Become Exceptional/newtonhelp.com
GSP 215 Become Exceptional/newtonhelp.comGSP 215 Become Exceptional/newtonhelp.com
GSP 215 Become Exceptional/newtonhelp.com
 
GSP 215 Perfect Education/newtonhelp.com
GSP 215 Perfect Education/newtonhelp.comGSP 215 Perfect Education/newtonhelp.com
GSP 215 Perfect Education/newtonhelp.com
 
GSP 215 Enhance teaching/tutorialrank.com
 GSP 215 Enhance teaching/tutorialrank.com GSP 215 Enhance teaching/tutorialrank.com
GSP 215 Enhance teaching/tutorialrank.com
 
GSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.comGSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.com
 
Gsp 215 Believe Possibilities / snaptutorial.com
Gsp 215  Believe Possibilities / snaptutorial.comGsp 215  Believe Possibilities / snaptutorial.com
Gsp 215 Believe Possibilities / snaptutorial.com
 
GSP 215 Effective Communication - tutorialrank.com
GSP 215  Effective Communication - tutorialrank.comGSP 215  Effective Communication - tutorialrank.com
GSP 215 Effective Communication - tutorialrank.com
 
Gsp 215 Enhance teaching-snaptutorial.com
Gsp 215 Enhance teaching-snaptutorial.comGsp 215 Enhance teaching-snaptutorial.com
Gsp 215 Enhance teaching-snaptutorial.com
 
GSP 215 Education Organization - snaptutorial.com
GSP 215  Education Organization - snaptutorial.comGSP 215  Education Organization - snaptutorial.com
GSP 215 Education Organization - snaptutorial.com
 
GSP 215 Technology levels--snaptutorial.com
GSP 215 Technology levels--snaptutorial.comGSP 215 Technology levels--snaptutorial.com
GSP 215 Technology levels--snaptutorial.com
 
Gsp 215 Massive Success / snaptutorial.com
Gsp 215  Massive Success / snaptutorial.comGsp 215  Massive Success / snaptutorial.com
Gsp 215 Massive Success / snaptutorial.com
 
Gsp 215 Enthusiastic Study / snaptutorial.com
Gsp 215 Enthusiastic Study / snaptutorial.comGsp 215 Enthusiastic Study / snaptutorial.com
Gsp 215 Enthusiastic Study / snaptutorial.com
 
GSP 215 RANK Education Your Life--gsp215rank.com
GSP 215 RANK Education Your Life--gsp215rank.comGSP 215 RANK Education Your Life--gsp215rank.com
GSP 215 RANK Education Your Life--gsp215rank.com
 
GSP 215 RANK Lessons in Excellence-- gsp215rank.com
GSP 215 RANK Lessons in Excellence-- gsp215rank.comGSP 215 RANK Lessons in Excellence-- gsp215rank.com
GSP 215 RANK Lessons in Excellence-- gsp215rank.com
 
GSP 215 RANK Inspiring Innovation--gsp215rank.com
GSP 215 RANK Inspiring Innovation--gsp215rank.com GSP 215 RANK Inspiring Innovation--gsp215rank.com
GSP 215 RANK Inspiring Innovation--gsp215rank.com
 
GSP 215 RANK Introduction Education--gsp215rank.com
GSP 215 RANK Introduction Education--gsp215rank.comGSP 215 RANK Introduction Education--gsp215rank.com
GSP 215 RANK Introduction Education--gsp215rank.com
 

More from SaravananVijayakumar4

More from SaravananVijayakumar4 (17)

EE337 Microprocessors Lab Labsheet 5
EE337 Microprocessors Lab Labsheet 5EE337 Microprocessors Lab Labsheet 5
EE337 Microprocessors Lab Labsheet 5
 
EE337 Spring 2023 Lab1
EE337 Spring 2023 Lab1EE337 Spring 2023 Lab1
EE337 Spring 2023 Lab1
 
EE337 Microprocessor Lab, Course Outline, Spring 2023
EE337 Microprocessor Lab, Course Outline, Spring 2023EE337 Microprocessor Lab, Course Outline, Spring 2023
EE337 Microprocessor Lab, Course Outline, Spring 2023
 
EE337 Course introduction 2021
EE337 Course introduction 2021EE337 Course introduction 2021
EE337 Course introduction 2021
 
EE 337 Lab 1 for Section 1 (2nd year UG)
 EE 337 Lab 1 for Section 1 (2nd year UG) EE 337 Lab 1 for Section 1 (2nd year UG)
EE 337 Lab 1 for Section 1 (2nd year UG)
 
Intel Hex Format
Intel Hex FormatIntel Hex Format
Intel Hex Format
 
Getting started with Keil uVision 2020
Getting started with Keil uVision 2020Getting started with Keil uVision 2020
Getting started with Keil uVision 2020
 
EE337 Course introduction 2021
EE337 Course introduction 2021EE337 Course introduction 2021
EE337 Course introduction 2021
 
Hex file creation using Keil uVision
Hex file creation using Keil uVisionHex file creation using Keil uVision
Hex file creation using Keil uVision
 
Serial IO for 8051
Serial IO for 8051Serial IO for 8051
Serial IO for 8051
 
8051 Timers
8051 Timers8051 Timers
8051 Timers
 
8051 Interrupts
8051 Interrupts8051 Interrupts
8051 Interrupts
 
Introduction to Microcontrollers
Introduction to MicrocontrollersIntroduction to Microcontrollers
Introduction to Microcontrollers
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction set
 
89c5131datasheet
89c5131datasheet89c5131datasheet
89c5131datasheet
 
Pt-51 User Manual
Pt-51 User ManualPt-51 User Manual
Pt-51 User Manual
 
EE337 Course introduction 2018
EE337 Course introduction 2018EE337 Course introduction 2018
EE337 Course introduction 2018
 

Recently uploaded

Recently uploaded (20)

How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 

Lab2 of EE337 Microprocessors Lab, 2022, IIT Bombay

  • 1. Assignment 2: 20 points EE 337: Microprocessors Laboratory (Spring 2022) Indian Institute of Technology Bombay Date: January 18, 2022 1. [5 points] Write an assembly language program to add two 16-bit numbers x and y. Use the following program as a starting point. Add your code in the ADD16 subroutine. // -- DO NOT CHANGE ANYTHING UNTIL THE **** LINE--// ORG 0H LJMP MAIN ORG 100H MAIN: CALL ADD16 HERE: SJMP HERE ORG 130H // ***************** ADD16: // ADD YOUR CODE HERE RET END ˆ The number x is stored at locations 70H and 71H, with its most significant byte (MSB) in 70H and the least significant byte in 71H. ˆ The number y is stored at locations 72H (MSB) and 73H (LSB). ˆ Since the result z = x + y can be 17 bits long, store the result in memory locations 74H, 75H, 76H. ˆ For z = z16z15z14 . . . z3z2z1z0 where z0 is the least significant bit and z16 is the most significant bit, the memory location 74H should have 0000000z16, the memory location 75H should have the bits z15z14 . . . z8, and the memory location 76H should have the bits z7z6 . . . z0. 2. [15 points] In a fully connected neural network, forward propagation involves the Multiply and Accumulate (MAC) operation. The neuron input is multiplied with the weight attributed to the path between that neuron and the neuron to the next layer. Then, all such products coming from different source neurons to the same destination neuron are added. Let us consider the neuron inputs to be a1, a2, a3. Let the corresponding weights be b1, b2, b3. The result after the MAC operation will be x = a1b1 + a2b2 + a3b3. Write an assembly language program to generate the result x, when a1, a2, a3 are three 8-bit neuron inputs present in the memory locations 70H to 72H and b1, b2, b3 are 8-bit weights present in the memory locations 73H to 75H. Since the result x can be 18 bits long, store the result in memory locations 50H, 51H, 52H. For x = x17x16x15 . . . x3x2x1x0, the memory location 50H should have 000000x17x16, the memory location 51H should have the bits x15x14 . . . x8, and the memory location 52H should have the bits x7x6 . . . x0.
  • 2. Use the following program as a starting point. Use the ADD16 subroutine written in the previous question to implement the MAC operation. // -- DO NOT CHANGE ANYTHING UNTIL THE **** LINE--// ORG 0H LJMP MAIN ORG 100H MAIN: CALL MAC HERE: SJMP HERE ORG 130H // ***************** MAC: // MAC OPERATION, CALL THE ADDITION SUBROUTINE USING "CALL ADD16" RET ADD16: //16 BIT ADDITION CODE RET END TA Checkpoints 1. For question 1, check the following two cases: ˆ x = 1234H, y = DCBAH. ˆ x = FFFFH, y = FFFFH. 2. For question 2, check the following three cases: ˆ a1, a2, a3 = 18H, 24H, 0CH, b1, b2, b3 = 03H, 02H, 06H. ˆ a1, a2, a3 = FFH, FFH, 01H, b1, b2, b3 = FFH, FFH, FFH. ˆ a1, a2, a3 = FFH, FFH, FFH, b1, b2, b3 = FFH, FFH, FFH. 3. For question 2, ask the student to explain the code in the MAC subroutine.