freechipsproject / chisel-bootcamp

Generator Bootcamp Material: Learn Chisel the Right Way
Apache License 2.0
982 stars 278 forks source link

value step is not a member of chisel3.Clock in 3.2 #171

Closed linuxlonelyeagle closed 2 years ago

linuxlonelyeagle commented 2 years ago

I write code in the idea, when i run test, there is a error,i hope someone can help me, I would be grateful,thanks!

[error] /home/sen/chiesl3.3/src/test/scala/BasicTest.scala:29:15: value step is not a member of chisel3.Clock
[error]       c.clock.step(1)
[error]               ^
[error] four errors found

Here is my code.

import chisel3._
import chiseltest._
import org.scalatest.flatspec.AnyFlatSpec
import chisel3.util._
import chisel3.tester._

class BasicTest extends AnyFlatSpec with ChiselScalatestTester
{
  behavior of "test"
  it should "do something" in {
    test(new Module {
      val io = IO(new Bundle {
        val in = Flipped(Decoupled(UInt(8.W)))
        val out = Decoupled(UInt(8.W))
      })
      val queue = Queue(io.in, 2)
      io.out <> queue
    }) { c =>
      c.io.out.ready.poke(false.B)
      c.io.in.valid.poke(true.B)
      c.io.in.bits.poke(42.U)
      println(s"Starting:")
      println(s"\tio.io:ready=${c.io.in.ready.peek().litValue}")
      println(s"\tio.out: valid=${c.io.out.valid.peek().litValue}, bits=${c.io.out.bits.peek().litValue}")
      c.clock.step(1)
    }
  }
}
chick commented 2 years ago

Try removing the line import chisel3.tester._ I'm don't think that belongs there

linuxlonelyeagle commented 2 years ago

@chick This problem has been solved,thanks!But I have a question,why does the use of import chisel3.tester._ here cause this problem? I don't really understand,thanks!

chick commented 2 years ago

I'm glad that worked for you. I'm not sure but my guess would be that there an implicit of some sort in chiseltest._ is being overridden by something in chisel3.tester._.

linuxlonelyeagle commented 2 years ago

@chick I really appreciate you helping me with this problem,thanks!