diff --git a/Cargo.lock b/Cargo.lock index 70c55dcc1..7572443f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -354,6 +354,7 @@ dependencies = [ "calyx-frontend", "calyx-ir", "calyx-utils", + "interp", "proc-macro2", "quote", "syn 2.0.87", diff --git a/tools/calyx-ffi-macro/Cargo.toml b/tools/calyx-ffi-macro/Cargo.toml index e9d1eddc1..88d8b42af 100644 --- a/tools/calyx-ffi-macro/Cargo.toml +++ b/tools/calyx-ffi-macro/Cargo.toml @@ -18,7 +18,7 @@ proc-macro = true proc-macro2 = "1.0.86" quote = "1.0.36" syn = { version = "2.0.69", features = ["full", "visit"] } +interp = { path = "../../interp" } calyx-utils.workspace = true calyx-frontend.workspace = true calyx-ir.workspace = true -# bigint = "4.4.3" diff --git a/tools/calyx-ffi-macro/src/calyx.rs b/tools/calyx-ffi-macro/src/calyx.rs index 403932197..73490bfd2 100644 --- a/tools/calyx-ffi-macro/src/calyx.rs +++ b/tools/calyx-ffi-macro/src/calyx.rs @@ -19,7 +19,7 @@ pub fn parse_calyx_file( args: &CalyxFFIMacroArgs, file: PathBuf, ) -> Result { - // there has to be a better way to find lib + // TODO(ethan): there has to be a better way to find lib let home_dir = env::var("HOME").expect("user home not set"); let mut lib_path = PathBuf::from(home_dir); lib_path.push(".calyx"); diff --git a/tools/calyx-ffi-macro/src/lib.rs b/tools/calyx-ffi-macro/src/lib.rs index a6329225d..ac7a0bb02 100644 --- a/tools/calyx-ffi-macro/src/lib.rs +++ b/tools/calyx-ffi-macro/src/lib.rs @@ -11,9 +11,6 @@ mod calyx; mod parse; mod util; -// this is super bad, might go out of sync with interp::WidthInt -type WidthInt = u32; - /// Connects this `struct` to a calyx component in the given file. #[proc_macro_attribute] pub fn calyx_ffi(attrs: TokenStream, item: TokenStream) -> TokenStream { @@ -66,7 +63,7 @@ pub fn calyx_ffi(attrs: TokenStream, item: TokenStream) -> TokenStream { port_names.push(port_name.clone()); - let port_width = port.borrow().width as WidthInt; + let port_width = port.borrow().width as interp::WidthInt; let width_getter = format_ident!("{}_width", port_name); width_getters.push(quote! { pub const fn #width_getter() -> calyx_ffi::value::WidthInt {