Step 7 of Self-writing the CPU (8) -- verify the implementation of the multiplication and accumulation commands

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.