chipsalliance/chisel-template

failed to build the GCD module

zhutmost opened this issue · 4 comments

Hi developers,

I'm trying to build the GCD module as follows,

package gcd

import chisel3._

/**
  * Compute GCD using subtraction method.
  * Subtracts the smaller from the larger until register y is zero.
  * value in register x is then the GCD
  */
class GCD extends Module {
  val io = IO(new Bundle {
    val value1        = Input(UInt(16.W))
    val value2        = Input(UInt(16.W))
    val loadingValues = Input(Bool())
    val outputGCD     = Output(UInt(16.W))
    val outputValid   = Output(Bool())
  })

  val x  = Reg(UInt())
  val y  = Reg(UInt())

  when(x > y) { x := x - y }
    .otherwise { y := y - x }

  when(io.loadingValues) {
    x := io.value1
    y := io.value2
  }

  io.outputGCD := x
  io.outputValid := y === 0.U
}

But it failed for some bugs I cannot solve. Here is the log of builder.
image

Thank you.

Can you show us the Dragonfly.scala file?

Oh, it's just the file name of the gcd module.

Thank you, ucbjrl. I bumped the scalaVersion to 2.11.12. and solved.
This issue can be closed.