Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise 6 Goal: Understanding the relationship between high-level language and assembler, Un- derstanding the programming model of a CPU using the example of an Atmel

image text in transcribed

image text in transcribed

image text in transcribed

Exercise 6 Goal: Understanding the relationship between high-level language and assembler, Un- derstanding the programming model of a CPU using the example of an Atmel AVR ATmega32 microcontroller.. Example program ex01: ldi r16, 0b11111111 ldi r17, 0500000001 loop : sub r16, 117 cpi r16, 0500000000 brlt loop Task 1. Given is the assembler program ex01 that implements a particular loop shape. Specify the meaning of the lines in "pseudo-code. Task 2. For the following program, specify the result of the arithmetic operation and the contents of the status register. Select which results are correct and which represent an overflow (if the values are interpreted as unsigned or signed): a) ldi r16,0x84 ldi r17.0x85 add r16,r17 b) Idi r18.0x84 ldi r19.0x04 add r18,r19 Task 2. For the following program, specify the result of the arithmetic operation and the contents of the status register. Select which results are correct and which represent an overflow (if the values are interpreted as unsigned or signed): a) Idi r16,0x84 Idi r17,0x85 add r16 r17 b) Idi r18.0x84 Idi r19.0x04 add r18.r19 c) ldi r20,0x40 Idi r21.0x42 add r20.121 d) ldi r22,0x60 ldi r23.0xEO add r22.r23 We consider the flags V. N. Z. and C with following meaning: Bit 0 (c): Carry Flag: signals a carry in an arithmetic or logical operation (Bit7 to Bits). Bit 1 (Z): Zero Flag: If the result of an arithmetic or logical operation is zero, the Z bit is set. Bit 2 (N): Negative Flag: indicates a negative result in an arithmetic or logical operation (equivalent to the value of bit 7). Bit 3 (V): Two's Complement Overflow Flag: signals overflows in arithmetic op- erations in 2's complement (falsified sign in bit 7). Only happens if numbers have same sign program a) V N Z 0/10/10/10/1 0/10/10/10/1 solution Ox?? Ox?? interpretation signed (OK/overflow) unsigned (OK /overflow)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

=+j Improve the effectiveness of global and virtual teams.

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago