Advertisement
Guest User

Untitled

a guest
Mar 14th, 2014
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 1.21 KB | None | 0 0
  1.     var product: Bus = aa.host.inputs(aa.length + bb.length)
  2.     var multiplier: Bus = aa.host.inputs(aa.length + bb.length)
  3.     var multiplicand: Bus = bb.host.inputs(aa.length + bb.length)
  4.     var adder: Bus = buildAdder(product, multiplier && multiplicand(0))
  5.     product.buildFeedback(adder)
  6.    
  7.     // build shift feedbacks.
  8.     var zero: Bus = aa.host.falses(1);
  9.     multiplier(0).buildFeedback(aa(0) && loadEnable)
  10.     for(i <- 1 until multiplier.length-1) {
  11.       println(i)
  12.       if(i < aa.length) {
  13.         multiplier(i).buildFeedback((multiplier(i-1) && !loadEnable) || (aa(i) && loadEnable))
  14.       } else {
  15.         multiplier(i).buildFeedback(multiplier(i-1) && !loadEnable)
  16.       }
  17.     }
  18.     for(i <- 1 until multiplicand.length) {
  19.       if(i < bb.length) {
  20.         multiplicand(i-1).buildFeedback((multiplicand(i) && !loadEnable) || (bb(i-1) && loadEnable))
  21.       } else {
  22.         multiplicand(i-1).buildFeedback(multiplicand(i) && !loadEnable)
  23.       }
  24.     }
  25.    
  26.     // check whether multiplication is ready.
  27.     // (~operands).values.reduce((A,B) => A & B)
  28.    
  29.     // final product with adder.
  30.    //product = buildAdder(product, multiplicand /* && multiplier(0)*/)
  31.    
  32.     (!loadEnable, product)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement