SRL Archive - General

MIC-1 Micro program


Mr. Roboto

2013-03-20 17:46:10

Does anyone know MIC-1 that can help me code this?

Three temporary registers are required (A,B,C)

i) Initialize A to zero
Move Multiplicand to B
Move multiplier to C

ii) Repeat the following N times where register size = N bits
a. 1-bit Logical Left shift A
b. If ( leftmostbit of C is 1 )
then { add B to A }
c. 1-bit Logical Left shift C

I don't know if it is allowed but I am willing to pay for the help through something like paypal.

Kevin

2013-03-20 17:52:35

Paying for the help in any manner isn't allowed, sorry.

But, I am intrigued by this. Is MIC-1 a form of assembly language, possibly based off of MIPS?

Mr. Roboto

2013-03-20 18:08:02

The MIC-1 is a processor architecture, it looks a lot like assembly but is a microprogram. I am trying to do multiplication using that algorithm but my teacher wont even explain it.

Kevin

2013-03-20 18:46:54

Oh, more like Quartus. I hate those. Yeah, sorry, I don't think I can help with this one as I'm not familiar with MIC-1.

Brandon

2013-03-20 19:58:58

I'd translate this into MIC but I'd have to learn MIC which might take an hr or two (fast learner.. I know..) to get a hang of the syntax.. So I'm posting it in x86 in hopes that you can do that yourself..

Let me know if you guys see any mistakes..


format PE console
entry main

include 'macro/import32.inc'

section '.idata' import data readable
library msvcrt,'msvcrt.dll'
import msvcrt, printf, 'printf',\
exit,'exit', getchar, 'getchar', scanf, 'scanf'

section '.data' data readable writeable
GetMultiplicand db "Enter A Multiplicand: ", 13, 10, 0
GetMultiplier db "Enter A Multiplier: ", 13, 10, 0
InputFormat db "%d", 0
Multiplicand dd 0
Multiplier dd 0


section '.code' code readable executable
main:
push ebp
mov ebp,esp

push GetMultiplicand
call [printf]
add esp, 4

push Multiplicand
push InputFormat
call [scanf]
add esp, 8

push GetMultiplier
call [printf]
add esp, 4

push Multiplier
push InputFormat
call [scanf]
add esp, 8

mov eax, 0
mov ebx, Multiplicand
mov edx, Multiplier

mov ecx, 20h

TheLoop:
shl eax, 1b
mov edi, edx
and edi, 8000000h
cmp edi, 1b
jne NotOne
add eax, ebx
NotOne:
shl edx, 1b
loop TheLoop

mov esp, ebp
pop ebx

call [getchar]
call [getchar]

mov eax, 0
ret