ucb-bar / chisel-tutorial

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

Update deprecations #150

Closed ucbjrl closed 5 years ago

ucbjrl commented 5 years ago

Replace toBool with asBool. Ensure each test run uses a fresh TesterOptionsManager so we don't end up with:

firrtl.options.OptionsException: Multiply defined input FIRRTL sources. More than one of the following was found:
    - an input file (0 times):  -i, --input-file,    FirrtlFileAnnotation
    - FIRRTL source (0 times):      --firrtl-source, FirrtlSourceAnnotation
    - FIRRTL circuit (2 times):                      FirrtlCircuitAnnotation
ucbjrl commented 5 years ago

We may want to hold off on committing these changes to release until we publish a 3.1.x version that supports asBool. They should be fine for master

ucbjrl commented 5 years ago

That's an excellent point. Let me try to address it.

ucbjrl commented 5 years ago

Would it be better to address this by adding a copy method to TesterOptionsManager? Then we could copy it once the arguments have been parsed (instead of repeatedly parsing the arguments).

chick commented 5 years ago

I'd say that would have been worth doing if we were sticking to OptionsManagers but given Stage/Phases I would say "no, it's not worth it". I'd just write a utility copy method of your own like

object OptionsCopy {
  def apply(t: TesterOptionsManager): TesterOptionsManager = {
    new TesterOptionsManager {
      testerOptions = t.testerOptions.copy()
      interpreterOptions = t.interpreterOptions.copy()
      chiselOptions = t.chiselOptions.copy()
      firrtlOptions = t.firrtlOptions.copy()
      treadleOptions = t.treadleOptions.copy()
    }
  }
}