ucb-bar / chisel-tutorial

chisel tutorial exercises and answers
Other
696 stars 197 forks source link

why the code of VendingMachineSwitch.scala in the tutorial generate if-else statement instead of case statement #151

Open qgzln opened 5 years ago

qgzln commented 5 years ago

How to generate a case statement for state machine with chisel3

schoeberl commented 5 years ago

You need to include chisel3.util._ and use a switch. See an example here: https://github.com/schoeberl/chisel-book/blob/master/src/main/scala/SimpleFsm.scala

qgzln commented 5 years ago

Thank you for your reply.It is my fault.I didn't make it clear, I mean there is no case in the generated Verilog statement, I usually use the case when writing the state machine with Verilog. So, chisel3 still can not generate Verilog code with case?