# conversion from single cycle to multicycle

Discussion in 'Homework Help' started by GipsyDanger, Dec 12, 2013.

1. ### GipsyDanger Thread Starter New Member

Dec 12, 2013
3
0
hello again
i wanna ask how to convert a single cycle MIPS code to multicycle
i dont have any idea to do this

for example, MIPS code

Code ( (Unknown Language)):
1. .data 0x10010000
2. prompt1:    .asciiz "Insert an integer: "
3. prompt2:    .asciiz "Insert number of loops: "
4.         .text
5. .globl main
6.
7. main:   # preparation
8. addu \$s0, \$ra, \$0       # save \$31 in \$16
9.
10.         # input x
11.         la \$a0,prompt1              # print string
12. li \$v0,4                # service 4
13. syscall
14.
15. li \$v0,5                # read int into \$v0 (x)
16.         syscall                 # service 5
17.         move \$t3, \$v0           # move x to \$t3
18.
19.         # input p
20.         la \$a0,prompt2              # print string
21. li \$v0,4                # service 4
22. syscall
23.
24. li \$v0,5                # read int into \$v0 (p)
25. syscall                 # service 5
26.         move \$t1, \$v0           # move p to \$t1
27.
28.         # prepare counter (a)
29. li \$t0, 0
30.
31.         # prepare multiplier
32. li \$t2, -2              # looping
33.
34. loop :  bge \$t0, \$t1, ended
35.         mult \$t3, \$t2
36.         mflo \$t3
38. j loop
39.
40. ended :     # print result
41. move \$a0, \$t3
42. li \$v0,1
43.         syscall
44.
45.         # ending
47.         jr \$ra                  # return from main
48.
this code is a code to compute the value of a using recursion and wont stop until a value is same with other value.
The question is how do i convert them to multicycle?
and what about if different code is used?