Problem 3 Suppose that we want to set content ofthe memory location X to 1 using
ID: 664184 • Letter: P
Question
Problem 3 Suppose that we want to set content ofthe memory location X to 1 using either a Software or a Hardware Approach a) Software te an assembly language program that sets the content of location X to using the instruction set of the processor in chapter 5. Also obtain the running time of this program, ie the number of clock cycles that it takes to run this program. (10 points) Hardware Implementation. Suppose that instruction Set X is added to the instruction set of the processor in Chapter 5. This instruction sets content of the memory location X to 1. Assuming that the op-co for this instruction is 000 e., when D0-1), write down micro-operations and their corresponding control functions for the Execute Cycle of this instruction. Also obtain number of clock cycles that it takes to run this instruction (10 points)Explanation / Answer
a)
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl $1, -4(%rbp)
movl $0, %eax
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
b)
#define PORTA (*(volatile unsigned char *)0x3B)
#define BIT(x) (1 << (x))
// find the bit position
PORTA |= BIT(0); //turn on the 0th bit
PORTA &= ~BIT(0); // turn off the 0th bit
PORTA ^= BIT(0); //toggle the 0th bit
PORTA ^= BIT(1); //set to 1
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.