I will upload my new book "Write CPU by myself". Today is 31st articles. I try to write them every Thursday.
The sales address of Amazon is as follows. You are welcome to look around!
Http://www.amazon.cn/dp/b00mqkrlg8/ref=cm_sw_r_si_dp_5kq8tb1gyhja4
The sales address of China-pub is as follows:
Http://product.china-pub.com/3804025
The sales address of beifa is as follows:
Http://book.beifabook.com/Product/BookDetail.aspx? Plucode = 712123950 & extra = 0_s25960657
7.9 Test the effect of the multiplication, accumulation, and subtraction commands
. Org 0x0. set noat. global _ start_start: Ori $1, $ xFFFF sll $1, $ Ori $1, $ xfffb #$1 =-5 is the initial value of Ori $2, $ #$2 = 6 is the register $2 assigned Initial Value mult $1, $2 # Hi = 0 xffffffff # Lo = 0xffffffe2 MADD $1, $2 # Hi = 0 xffffffff # Lo = 0xffffffc4 maddu $1, $2 # Hi = 0x5 # Lo = 0xffffffa6 Msub $1, $2 # Hi = 0x5 # Lo = 0xffffffc4 msubu $1, $2 # Hi = 0 xffffffff # Lo = 0xffffffe2
The program comments show the expected execution results for four consecutive multiply, accumulate, and subtract commands. Modelsim simulation 7-14 is shown. We can see that the multiplication, accumulation, and multiplication, and subtraction commands are correctly implemented. At the same time, we can see that the multiplication, accumulation, and multiplication, and subtraction commands require two clock cycles to be completed.
Code http://download.csdn.net/detail/leishangwen/7858701
Next time, we will introduce the implementation process of Division commands. Please stay tuned!
Step 7 of Self-writing the CPU (8) -- verify the implementation of the multiplication and accumulation commands