http://eniac.cs.qc.cuny.edu/cs240/powerpoints/Factorial.asm write it the format
ID: 3841552 • Letter: H
Question
http://eniac.cs.qc.cuny.edu/cs240/powerpoints/Factorial.asm
write it the format link above. with comment
D MIPS2DArrayAssignme c Chegg Study Guided YouTube Upload Assignment: A C a file://VC /Users/Will/Downloads/MIPS2DArrayAssignment.pdf MIPS Two Dimensional Array Assignment Overview This assignment must be done as an individual effort. You cannot work together on this assignment. I will be on the alert for submissions which look extremely alike! Before working on this assignment read CUNY's Policy on Academic Integ In class, the discussion of arrays in MIPS assembly language dealt with implementing a one dimensional array and accessing an element of the array by computing its memory address Implementation of two dimensional arrays in a MIPS assembly language program depends on how the elements in the rows and columns of the array are arranged in memory. There are two types of arrangement, Row-Major Order or Column-Major Order. Some languages use Row-Major Order and other languages use Column-Major Order In this assignment, you use Row-Major Order to store a two dimensional array In Row-Major Order, elements of an array are arranged sequentially row by row. Thus elements of the first row occupy the first set of memory locations reserved for the array, elements of the second row occupy the next set of memory locations reserved for the array and so on. For a two dimensional array consisting of N rows and M columns B (base address of the array) is the memory address of the first element in the array W is the word size, the number of bytes occupied by each element N is the number of rows in the array Mis the number of columns in the array The formula [B W (M i J computes the memory address of element Ali Consider the following example of a two dimensional array A of integers consisting of two rows and three columns stored in Row-Major Order A [A100001 A[0][1] A 012 1110 AD1112 8:22 AMExplanation / Answer
Answer:
MIPS Assembly Language Code :
.LC0:
.string "a["
.LC1:
.string "]["
.LC2:
.string "]: "
main:
push rbp
mov rbp, rsp
sub rsp, 48
mov DWORD PTR [rbp-48], 0
mov DWORD PTR [rbp-44], 0
mov DWORD PTR [rbp-40], 1
mov DWORD PTR [rbp-36], 2
mov DWORD PTR [rbp-32], 2
mov DWORD PTR [rbp-28], 4
mov DWORD PTR [rbp-24], 3
mov DWORD PTR [rbp-20], 6
mov DWORD PTR [rbp-16], 4
mov DWORD PTR [rbp-12], 8
mov DWORD PTR [rbp-4], 0
.L5:
cmp DWORD PTR [rbp-4], 4
jg .L2
mov DWORD PTR [rbp-8], 0
.L4:
cmp DWORD PTR [rbp-8], 1
jg .L3
mov esi, OFFSET FLAT:.LC0
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)
mov rdx, rax
mov eax, DWORD PTR [rbp-4]
mov esi, eax
mov rdi, rdx
call std::basic_ostream<char, std::char_traits<char> >::operator<<(int)
mov esi, OFFSET FLAT:.LC1
mov rdi, rax
call std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)
mov rdx, rax
mov eax, DWORD PTR [rbp-8]
mov esi, eax
mov rdi, rdx
call std::basic_ostream<char, std::char_traits<char> >::operator<<(int)
mov esi, OFFSET FLAT:.LC2
mov rdi, rax
call std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)
mov eax, DWORD PTR [rbp-8]
cdqe
mov edx, DWORD PTR [rbp-4]
movsx rdx, edx
add rdx, rdx
add rax, rdx
mov eax, DWORD PTR [rbp-48+rax*4]
mov esi, eax
mov edi, OFFSET FLAT:std::cout
call std::basic_ostream<char, std::char_traits<char> >::operator<<(int)
mov esi, OFFSET FLAT:std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)
mov rdi, rax
call std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))
add DWORD PTR [rbp-8], 1
jmp .L4
.L3:
add DWORD PTR [rbp-4], 1
jmp .L5
.L2:
mov eax, 0
leave
ret
__static_initialization_and_destruction_0(int, int):
push rbp
mov rbp, rsp
sub rsp, 16
mov DWORD PTR [rbp-4], edi
mov DWORD PTR [rbp-8], esi
cmp DWORD PTR [rbp-4], 1
jne .L9
cmp DWORD PTR [rbp-8], 65535
jne .L9
mov edi, OFFSET FLAT:std::__ioinit
call std::ios_base::Init::Init()
mov edx, OFFSET FLAT:__dso_handle
mov esi, OFFSET FLAT:std::__ioinit
mov edi, OFFSET FLAT:std::ios_base::Init::~Init()
call __cxa_atexit
.L9:
nop
leave
ret
_GLOBAL__sub_I_main:
push rbp
mov rbp, rsp
mov esi, 65535
mov edi, 1
call __static_initialization_and_destruction_0(int, int)
pop rbp
ret
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.