hi!! i need the code for 32 bit multiplication...
The numbers are in IEEE 754 and it won't be needed to deal with over and underflow cases, and when the exponent is 0000000 or 11111111.
thanxx in advance ;P
hi!! i need the code for 32 bit multiplication...
The numbers are in IEEE 754 and it won't be needed to deal with over and underflow cases, and when the exponent is 0000000 or 11111111.
thanxx in advance ;P
i've already done half of it:
#read the numbers
li $v0, 6
syscall
mfc1 $s0, $f0
li $v0, 6
syscall
mfc1 $s1, $f0
#remove the exponents from both numbers and saving them in a0 and a1
.data
maskex: 0x7F800000
.text
xtractex: lw $t0, maskex
and $a0, $s0, $t0
and $a1, $s1, $t0
srl $a0, $a0, 23
srl $a1, $a1, 23
#remove the fraction
.data
maskma: 0x007FFFFF
.text
xtractma: lw $t1, maskma
and $a2, $s0, $t1
and $a3, $s1, $t1
#mask for the hidden bit
.data
maskhb: 0x00800000
.text
xtracthb: lw $t2, maskhb
or $a2, $a2, $t2
or $a3, $a3, $t3
#calculation of the exponent
add $t4, $a0, $a1
subi $t4, $t4, 127
-- what do you think?
I'm confused, are you trying to simply multiply or use exponents? If it is just multiplication you can just use the mult instruction in MIPS, it looks like this mult $s1, $s2. To get the integer use the mflo and mfhi instructions, which look like so mflo $s1, mfhi $s2. Since it is 32-bit multiplication the result is placed in two registers to mimic a 64-bit register.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.