From 696bc256a90cc80bcb094aaeada8eea51a643ae0 Mon Sep 17 00:00:00 2001 From: Schuyler Eldridge Date: Thu, 15 Nov 2018 21:50:29 -0500 Subject: Change firrtl.options API, add Phase This breaks firrtl.options.Stage into a small type hierarchy: * Phase: something that transforms an AnnotationSeq * Stage extends Phase: a Phase with a Command Line Interface Some of the old "common options" (input annotation file and target directory) are moved into firrtl.options and provided as part of the Stage class. Stage will automatically preprocess an input annotation sequence to resolve all input annotation files and add a default target directory. Minor changes: * Adds ViewException * Stops mixing in the DoNotTerminateOnExit trait into the default Shell parser * Add StageOptionsView Signed-off-by: Schuyler Eldridge --- src/main/scala/firrtl/options/OptionsView.scala | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main/scala/firrtl/options/OptionsView.scala') diff --git a/src/main/scala/firrtl/options/OptionsView.scala b/src/main/scala/firrtl/options/OptionsView.scala index dade5c56..aacd997e 100644 --- a/src/main/scala/firrtl/options/OptionsView.scala +++ b/src/main/scala/firrtl/options/OptionsView.scala @@ -12,7 +12,8 @@ trait OptionsView[T] { /** Convert an [[AnnotationSeq]] to some other type * @param options some annotations */ - def view(options: AnnotationSeq): Option[T] + def view(options: AnnotationSeq): T + } /** A shim to manage multiple "views" of an [[AnnotationSeq]] */ @@ -23,5 +24,6 @@ object Viewer { * @param optionsView a converter of options to the requested type * @tparam T the type to which the input [[AnnotationSeq]] should be viewed as */ - def view[T](options: AnnotationSeq)(implicit optionsView: OptionsView[T]): Option[T] = optionsView.view(options) + def view[T](options: AnnotationSeq)(implicit optionsView: OptionsView[T]): T = optionsView.view(options) + } -- cgit v1.2.3