Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
554 views
in Technique[技术] by (71.8m points)

verilog - How to perform right shifting binary multiplication?

This is a homework problem which I tried to solve by myself but I couldn't. The homework is to implement a circuit that multiplies two binary numbers by using right shifting. I don't have any problems with Verilog, my only problem is how to conclude the algorithm so I can implement it by myself.

This is the slide that explains the circuit

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Example multiplies. Note 4 bit adder produces a 5 bit sum (top bit is carry). Input to adder is multiplicand plus bits 3 to 6 of product register, the sum including carry, goes to bits 3 to 7 of product register.

multiplicand 1100, multiplier 0101

7 6 5 4 3 2 1 0         product bit index

0 0 0 0 0 1 0 1         initial 8 bit register

0 0 0 0 0 0 1 0    1    shift right, 1 bit shifted out
  1 1 0 0               add multiplicand
0 1 1 0 0 0 1 0         
0 0 1 1 0 0 0 1    0    shift right, 0 bit shifted out
  0 0 0 0               no add
0 0 1 1 0 0 0 1
0 0 0 1 1 0 0 0    1    shift right, 1 bit shifted out
  1 1 0 0               add multiplicand
0 1 1 1 1 0 0 0
0 0 1 1 1 1 0 0    0    shift right, 0 bit shifted out
  0 0 0 0               no add
0 0 1 1 1 1 0 0

multiplicand 1111, multiplier 1111

0 0 0 0 1 1 1 1         initial 8 bit register

0 0 0 0 0 1 1 1    1    shift right, 1 bit shifted out
  1 1 1 1               add multiplicand
0 1 1 1 1 1 1 1
0 0 1 1 1 1 1 1    1    shift right, 1 bit shifted out
  1 1 1 1               add multiplicand
1 0 1 1 0 1 1 1
0 1 0 1 1 0 1 1    1    shift right, 1 bit shifted out
  1 1 1 1               add multiplicand
1 1 0 1 0 0 1 1
0 1 1 0 1 0 0 1    1    shift right, 1 bit shifted out
  1 1 1 1               add multiplicand
1 1 1 0 0 0 0 1

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...