Chisel's Bool to Scala's Boolean Casting

433 prikaza
Preskoči na prvu nepročitanu poruku

Shigeyuki Takano

nepročitano,
27. srp 2021. 02:22:0927. 07. 2021.
u chisel-users
Hi,

I want to cast chisel's Bool var to Scala's Boolean type;
Its motivation is that conditional branch (Scala's if-statement) in tester2 to conditionally assign value by referencing from chisel code;

if (dut.io.ack == true) {
    dut.io.DatIn.poke(1234.U)
} else {
    dut.io.DatIn.poke(4321.U)
}
 for example. the if-statement is Scala(Java)'s grammar, so it can fail the execution, and inside of the if-statement should be a type supported by Scala, I think.

To casting correctly, is there method or something approach?

Best,
S.Takano

Edward Wang

nepročitano,
27. srp 2021. 13:21:1627. 07. 2021.
u chisel-users
Hello,

In the context of testers2, you should use litValue() -  e.g. dut.io.ack.litValue() == 1 or something along those lines.

Best,
Edward

Shigeyuki Takano

nepročitano,
27. srp 2021. 21:29:3427. 07. 2021.
u 'Bradley Geden' via chisel-users
Hi Wang-san,

Thank you for your advice!

I tried both of litValue() and litToBoolean, it makes an exception error;
java.util.NoSuchElementException: None.get

Could you please tell me reason why this error is happen?

Best,
S.Takano

2021/07/28 2:21、Edward Wang <edw...@berkeley.edu>のメール:

-- 
You received this message because you are subscribed to a topic in the Google Groups "chisel-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/chisel-users/wQUAb56mHa8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to chisel-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chisel-users/c92bcaf2-190e-444d-8b73-ceb0bb822d19n%40googlegroups.com.

Odgovori svima
Odgovori autoru
Proslijedi
0 novih poruka