Skip to content

Peek on internal Vec or elements of Seq?  #43

Description

@shunshou

I have an internal signal:

val state = Vec(Reg(init = Bool(true)) +: Seq.fill(p.numBits)(Reg(init = Bool(false))))

In the PeekPokeTester, I try

peek(c.state)

and get

[info] - should generate correct control signals *** FAILED ***
[info]   firrtl_interpreter.InterpreterException: Expression key state_0 already in stack
[info]   at firrtl_interpreter.ExpressionExecutionStack$$anonfun$push$1.apply(ExpressionExecutionStack.scala:42)
[info]   at firrtl_interpreter.ExpressionExecutionStack$$anonfun$push$1.apply(ExpressionExecutionStack.scala:36)
[info]   at scala.Option.foreach(Option.scala:257)
[info]   at firrtl_interpreter.ExpressionExecutionStack.push(ExpressionExecutionStack.scala:36)
[info]   at firrtl_interpreter.LoFirrtlExpressionEvaluator.evaluate(LoFirrtlExpressionEvaluator.scala:273)
[info]   at firrtl_interpreter.LoFirrtlExpressionEvaluator$$anonfun$3.apply(LoFirrtlExpressionEvaluator.scala:425)
[info]   at firrtl_interpreter.LoFirrtlExpressionEvaluator$$anonfun$3.apply(LoFirrtlExpressionEvaluator.scala:420)
[info]   at firrtl_interpreter.Timer.apply(Timer.scala:40)
[info]   at firrtl_interpreter.LoFirrtlExpressionEvaluator.firrtl_interpreter$LoFirrtlExpressionEvaluator$$resolveDependency(LoFirrtlExpressionEvaluator.scala:419)
[info]   at firrtl_interpreter.LoFirrtlExpressionEvaluator.getValue(LoFirrtlExpressionEvaluator.scala:81)

Some other attempt resulted in

overloaded method value peek with alternatives:
[error]   (signal: chisel3.Bits)BigInt <and>
[error]   (path: String)BigInt
[error]  cannot be applied to (chisel3.core.Vec[chisel3.core.Bool])
[error]     peek(c.io.debugStateOneHot.get)
[error]     ^


I try c.state.foreach { x => peek(x) } and get the same error.


What I really wanted to do was peek with each state being a Seq instead of a Vec a la:

val state = Reg(init = Bool(true)) +: Seq.fill(p.numBits)(Reg(init = Bool(false)))

with

c.state.foreach { x => peek(x) }

Resulting in:

java.util.NoSuchElementException: key not found: chisel3.core.Bool@25
[info]   at scala.collection.MapLike$class.default(MapLike.scala:228)
[info]   at scala.collection.AbstractMap.default(Map.scala:59)
[info]   at scala.collection.MapLike$class.apply(MapLike.scala:141)
[info]   at scala.collection.AbstractMap.apply(Map.scala:59)
[info]   at chisel3.iotesters.FirrtlTerpBackend.peek(FirrtlTerpBackend.scala:36)
[info]   at chisel3.iotesters.PeekPokeTester.peek(PeekPokeTester.scala:107)

OR

Ideally, I want peek(c.state) to work, where c.state is a Seq.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions