-
Notifications
You must be signed in to change notification settings - Fork 602
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added API to get Verilog from Chisel #676
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mostly looks good.
Also, does it make sense for this to be more general? Verilog is very much just one FIRRTL backend (though probably the most useful, for now), so this specific functionality seems like something that might be in utils or something rather than core.
src/main/scala/chisel3/Driver.scala
Outdated
@@ -95,6 +95,20 @@ object Driver extends BackendCompilationUtilities { | |||
|
|||
def emit[T <: RawModule](ir: Circuit): String = Emitter.emit(ir) | |||
|
|||
def emitVerilog[T <: RawModule](gen: () => T): String = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are two signatures needed? And can you just make one call the other (so we can be a little more DRY)?
src/main/scala/chisel3/Driver.scala
Outdated
} | ||
} | ||
|
||
def emitVerilog[T <: RawModule](gen: => T): String = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want scaladocs here?
b4689fa
to
7165c99
Compare
* @return the resulting String containing the design in Verilog | ||
*/ | ||
def emitVerilog[T <: RawModule](gen: => T): String = { | ||
execute(Array[String](), { () => gen }) match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we ever care about wanting to pass arguments to emitVerilog? (e.g. optional argument)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like an options manager or an array of string should be passed in. overloaded definitions for each one
def emitVerilog[T <: RawModule](gen: => T): String = { | ||
execute(Array[String](), { () => gen }) match { | ||
case ChiselExecutionSuccess(_, _, Some(firrtl.FirrtlExecutionSuccess(_, verilog))) => verilog | ||
case _ => sys.error("Cannot get Verilog!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to use ChiselException so that this can be caught?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, just had a few remaining questions.
No description provided.