Skip to content
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

Merged
merged 2 commits into from
Sep 6, 2017
Merged

Added API to get Verilog from Chisel #676

merged 2 commits into from
Sep 6, 2017

Conversation

azidar
Copy link
Contributor

@azidar azidar commented Aug 23, 2017

No description provided.

@azidar azidar requested a review from ducky64 August 23, 2017 20:23
Copy link
Contributor

@ducky64 ducky64 left a 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.

@@ -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 = {
Copy link
Contributor

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)?

}
}

def emitVerilog[T <: RawModule](gen: => T): String = {
Copy link
Contributor

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?

* @return the resulting String containing the design in Verilog
*/
def emitVerilog[T <: RawModule](gen: => T): String = {
execute(Array[String](), { () => gen }) match {
Copy link
Contributor

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)

Copy link
Contributor

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!")
Copy link
Contributor

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?

Copy link
Contributor

@edwardcwang edwardcwang left a 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.

@azidar azidar merged commit a97fbfc into master Sep 6, 2017
@edwardcwang edwardcwang deleted the update-driver branch December 12, 2017 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants