treadle icon indicating copy to clipboard operation
treadle copied to clipboard

Is it possible to access signals in clockChange?

Open davidmlw opened this issue 5 years ago • 2 comments

In current example, the users need maintain the internal states, the input/output update events. Is it possible to put all this in a single function clockChange? I imagine at the event clockChange, the signals can be access from a giant symbol table, so no need to prepare internal states and trace the input transitions.

for example, input could be peek, output could be poke. If this kind of synchronized clocked ScalaBlackBox is possible. It would be very useful for many verification cases. Verification doesn't need to be at combinational boundary, only at clock boundary is already very usefule :

override def clockChange(transition: Transition, clockName: String): Unit = {
     output("io_d") = input("io_d") + 1
     output("io_d2") = input("io_d1") + input("io_d2")
}

https://github.com/freechipsproject/treadle/blob/962acf6f7b5fbca3fe17ebe2897dcd48d6c465a1/src/test/scala/treadle/asyncreset/AsyncResetBlackBox.scala#L26-L56

davidmlw avatar Jul 09 '20 09:07 davidmlw

I think the first part of the answer is yes. You can put as much logic in the clockChange method as you would like. It would be relatively simple I think to provide a hook to the treadle ExecutionEngine which would let black boxes access treadle's DataStore this could be dangerous of course. I think it would also be nice to allow black box creation to request some DataStore variables of it's own. That way internal state of black boxes would be retained in the snapshot mechanism. I think mostly what this needs is prioritization

chick avatar Jul 10 '20 17:07 chick

I see. It is dangerous to open whole access to treadle's DataStore. It is reasonable to open the ScalaBlackBox's input and output port for default, while other internal states need other scheme to get access. I take Github as a open discussion panel for records. Please make development decisions based on available resources. I am reading treadle code and will make further investigation some time.

davidmlw avatar Jul 12 '20 13:07 davidmlw