-
Notifications
You must be signed in to change notification settings - Fork 52
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
Move numeric_types.py
from fud/verilator
to calyx-py
(another attempt at #1715 )
#1719
Changes from all commits
8425629
b5220d6
6b8e6f3
c056a8f
8944f31
d7daa27
84e7f9e
d63bcc1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,7 @@ | |
from pathlib import Path | ||
import simplejson as sjson | ||
import numpy as np | ||
from fud.stages.verilator.numeric_types import FixedPoint, Bitnum | ||
from fud.errors import InvalidNumericType | ||
from calyx.numeric_types import FixedPoint, Bitnum, InvalidNumericType | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It could be described as slightly weird, although not overwhelmingly weird, that fud depends on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, I think we should eventually externalize all these stages from the core logic in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the idea to have all stages be external then? Or rather to get rid of the notion of non-external stages? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I'd say barring any API problems, there should be no internal stages whatsoever. |
||
from fud.stages.verilator.json_to_dat import parse_fp_widths, float_to_fixed | ||
from fud.utils import shell, TmpDir, unwrap_or, transparent_shell | ||
from fud import config as cfg | ||
|
@@ -88,8 +87,9 @@ def _is_data_converter(self): | |
|
||
def _define_steps(self, input_data, builder, config): | ||
script = config["stages", self.name, "exec"] | ||
data_path_exists: bool = (config["stages", "verilog", "data"] or | ||
config.get(["stages", "mrxl", "data"])) | ||
data_path_exists: bool = config["stages", "verilog", "data"] or config.get( | ||
["stages", "mrxl", "data"] | ||
) | ||
|
||
cmd = [ | ||
script, | ||
|
@@ -118,7 +118,9 @@ def mktmp() -> SourceType.Directory: | |
""" | ||
return TmpDir() | ||
|
||
@builder.step(description="Dynamically retrieve the value of stages.verilog.data") | ||
@builder.step( | ||
description="Dynamically retrieve the value of stages.verilog.data" | ||
) | ||
def get_verilog_data() -> SourceType.Path: | ||
data_path = config.get(["stages", "verilog", "data"]) | ||
path = Path(data_path) if data_path else None | ||
|
@@ -197,9 +199,7 @@ def parse_output( | |
data_path = get_verilog_data() | ||
|
||
if data_path_exists: | ||
convert_json_to_interp_json( | ||
tmpdir, data_path | ||
) | ||
convert_json_to_interp_json(tmpdir, data_path) | ||
|
||
if self._is_data_converter(): | ||
if data_path_exists: | ||
|
@@ -213,9 +213,7 @@ def parse_output( | |
result = interpret(input_data, tmpdir) | ||
|
||
if "--raw" in cmd: | ||
return parse_output( | ||
result, data_path, tmpdir | ||
) | ||
return parse_output(result, data_path, tmpdir) | ||
else: | ||
return result | ||
|
||
|
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.
It is a great outcome here that the
calyx-py
library doesn't need to depend on fud for this. That direction of dependency was always extremely weird.