Skip to content

Commit dc75b3a

Browse files
authored
Merge branch 'main' into scheduling
2 parents 1ea63e1 + f679292 commit dc75b3a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+278
-271
lines changed

.github/workflows/format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- name: Install stable
1313
uses: actions-rs/toolchain@v1
1414
with:
15-
toolchain: 1.72.0
15+
toolchain: 1.85.0
1616
override: true
1717
components: rustfmt, clippy
1818
- name: Check formatting

.github/workflows/test.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,6 @@ jobs:
6767
needs: [hash, build]
6868
if: always() && !failure() && !cancelled()
6969
container: ghcr.io/cucapra/filament:${{ needs.hash.outputs.hash }}
70-
defaults:
71-
run:
72-
working-directory: /home/filament
7370
steps:
7471
- name: Copy fud configuration
7572
run: |
@@ -80,10 +77,14 @@ jobs:
8077
with:
8178
repository: cucapra/filament
8279
ref: ${{ github.sha }}
80+
- name: Reconfigure fud
81+
run: |
82+
fud register -p $GITHUB_WORKSPACE/fud/filament.py filament
83+
fud config stages.filament.exec $GITHUB_WORKSPACE/target/debug/filament
84+
fud config stages.filament.library $GITHUB_WORKSPACE
8385
- name: Build Filament
84-
uses: actions-rs/cargo@v1
85-
with:
86-
command: build
86+
run: |
87+
cargo build --all
8788
- name: Check versions
8889
run: |
8990
rustc --version

Cargo.toml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ readme = "README.md"
1111
description = "A language for Fearless Hardware Design"
1212
categories = ["compilers"]
1313
homepage = "https://filamenthdl.com"
14-
edition = "2021"
14+
edition = "2024"
1515
version = "0.1.0"
16-
rust-version = "1.67"
16+
rust-version = "1.85"
1717

1818
[workspace.dependencies]
1919
toml = "0.8"
@@ -37,6 +37,7 @@ tempfile = "3.13.0"
3737
strum = "0.26.3"
3838
strum_macros = "0.26.3"
3939
ordered-float = "5.0.0"
40+
boxcar = "0.2.10"
4041

4142
fil-utils = { version = "0.1.0", path = "crates/utils" }
4243
fil-ast = { version = "0.1.0", path = "crates/ast" }
@@ -59,10 +60,6 @@ default-features = false
5960
version = "0.11"
6061
features = ["ascii-only"]
6162

62-
[workspace.dependencies.string-interner]
63-
version = "0.14"
64-
features = ["backends", "std", "inline-more"]
65-
6663
[workspace.dependencies.bitvec]
6764
version = "1.0.1"
6865
features = ["alloc"]

Dockerfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ RUN wget https://github.com/chipsalliance/verible/releases/download/v0.0-3428-gc
6666
rm verible.tar.gz
6767
ENV PATH=$PATH:/home/verible/bin
6868

69-
# Set rust to 1.76 and runt to 0.4.1
70-
RUN rustup toolchain install 1.76.0 &&\
71-
rustup default 1.76.0 &&\
69+
# Set rust to 1.82 and runt to 0.4.1
70+
RUN rustup toolchain install 1.85.0 &&\
71+
rustup default 1.85.0 &&\
7272
cargo install runt --version 0.4.1
7373

7474
# ----------------------------------------
@@ -80,7 +80,6 @@ ADD . filament
8080
WORKDIR /home/filament
8181
# Make rust use sparse registries (https://doc.rust-lang.org/nightly/cargo/reference/registries.html#registry-protocols)
8282
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
83-
RUN cargo build --all
8483
# Set up fud
8584
RUN python3 -m pip install cocotb find_libpython pytest && \
8685
fud register -p fud/filament.py filament && \

crates/ast/src/component.rs

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::{Command, Id, Signature};
2-
use fil_gen as gen;
2+
use fgen::GenConfig;
3+
use fil_gen as fgen;
34
use fil_utils::{self as utils, AttrCtx};
4-
use gen::GenConfig;
55
use std::path::PathBuf;
66

77
#[derive(Default)]
@@ -10,15 +10,19 @@ pub struct Extern {
1010
pub path: String,
1111
pub comps: Vec<Signature>,
1212
/// name of the tool that generates this module
13-
pub gen: Option<String>,
13+
pub gen_tool: Option<String>,
1414
}
1515
impl Extern {
1616
pub fn new(
1717
path: String,
1818
comps: Vec<Signature>,
19-
gen: Option<String>,
19+
gen_tool: Option<String>,
2020
) -> Self {
21-
Self { path, comps, gen }
21+
Self {
22+
path,
23+
comps,
24+
gen_tool,
25+
}
2226
}
2327

2428
pub fn map_path<F>(mut self, func: F) -> Self
@@ -60,7 +64,9 @@ pub struct Namespace {
6064
impl Namespace {
6165
/// Returns true if the namespace declares at least one generative module
6266
pub fn requires_gen(&self) -> bool {
63-
self.externs.iter().any(|Extern { gen, .. }| gen.is_some())
67+
self.externs
68+
.iter()
69+
.any(|Extern { gen_tool, .. }| gen_tool.is_some())
6470
}
6571

6672
/// Initialize the generator executor using the given generate definitions.
@@ -71,14 +77,19 @@ impl Namespace {
7177
&self,
7278
out_dir: Option<PathBuf>,
7379
config: GenConfig,
74-
) -> gen::GenExec {
75-
let mut gen_exec = gen::GenExec::new(false, out_dir, config);
76-
for Extern { path, gen, .. } in &self.externs {
77-
let Some(tool_name) = gen else {
80+
) -> fgen::GenExec {
81+
let mut gen_exec = fgen::GenExec::new(false, out_dir, config);
82+
for Extern { path, gen_tool, .. } in &self.externs {
83+
let Some(tool_name) = gen_tool else {
7884
continue;
7985
};
8086
let tool = gen_exec.register_tool_from_file(path.into());
81-
assert!(&tool.name == tool_name, "Generate definition for tool `{}` does not match the tool name `{}`", tool_name, tool.name);
87+
assert!(
88+
&tool.name == tool_name,
89+
"Generate definition for tool `{}` does not match the tool name `{}`",
90+
tool_name,
91+
tool.name
92+
);
8293
}
8394
gen_exec
8495
}

crates/ast/src/parser.rs

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use fil_utils::{
99
};
1010
use itertools::Itertools;
1111
use pest::pratt_parser::{Assoc, Op, PrattParser};
12-
use pest_consume::{match_nodes, Error, Parser};
12+
use pest_consume::{Error, Parser, match_nodes};
1313
use std::fs;
1414
use std::hash::Hash;
1515
use std::path::Path;
@@ -42,8 +42,8 @@ lazy_static::lazy_static! {
4242
}
4343

4444
pub enum BodyEl {
45-
Ext(ast::Extern),
46-
Comp(ast::Component),
45+
Ext(Box<ast::Extern>),
46+
Comp(Box<ast::Component>),
4747
}
4848

4949
#[derive(Clone)]
@@ -73,10 +73,10 @@ impl FilamentParser {
7373
})?;
7474
// Add a new file to the position table
7575
let string_content = std::str::from_utf8(content)?.to_string();
76-
let file = GlobalPositionTable::as_mut()
76+
let file = GlobalPositionTable::get()
7777
.add_file(path.to_string_lossy().to_string(), string_content);
7878
let user_data = UserData { file };
79-
let (_, content) = GlobalPositionTable::as_ref().get_file_data(file);
79+
let (_, content) = GlobalPositionTable::get().get_file_data(file);
8080
// Parse the file
8181
let inputs =
8282
FilamentParser::parse_with_userdata(Rule::file, content, user_data)
@@ -111,11 +111,8 @@ impl FilamentParser {
111111
fn get_span(node: &Node) -> GPosIdx {
112112
let ud = node.user_data();
113113
let sp = node.as_span();
114-
let pos = GlobalPositionTable::as_mut().add_pos(
115-
ud.file,
116-
sp.start(),
117-
sp.end(),
118-
);
114+
let pos =
115+
GlobalPositionTable::get().add_pos(ud.file, sp.start(), sp.end());
119116
GPosIdx(pos)
120117
}
121118

@@ -901,9 +898,9 @@ impl FilamentParser {
901898
fn comp_or_ext(input: Node) -> ParseResult<BodyEl> {
902899
Ok(match_nodes!(
903900
input.into_children();
904-
[external(sig)] => BodyEl::Ext(sig),
905-
[generate(sig)] => BodyEl::Ext(sig),
906-
[component(comp)] => BodyEl::Comp(comp),
901+
[external(sig)] => BodyEl::Ext(Box::new(sig)),
902+
[generate(sig)] => BodyEl::Ext(Box::new(sig)),
903+
[component(comp)] => BodyEl::Comp(Box::new(comp)),
907904
))
908905
}
909906

@@ -925,8 +922,8 @@ impl FilamentParser {
925922

926923
for m in mixed {
927924
match m {
928-
BodyEl::Ext(sig) => namespace.externs.push(sig),
929-
BodyEl::Comp(comp) => namespace.components.push(comp),
925+
BodyEl::Ext(sig) => namespace.externs.push(*sig),
926+
BodyEl::Comp(comp) => namespace.components.push(*comp),
930927
}
931928
}
932929
namespace

crates/filament/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ struct-variant.workspace = true
3434
env_logger.workspace = true
3535
codespan-reporting.workspace = true
3636
bitvec.workspace = true
37-
string-interner.workspace = true
3837
fil-ast.workspace = true
3938
fil-ir.workspace = true
4039
fil-utils.workspace = true

crates/filament/src/cmdline.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ impl FromStr for Solver {
1919
"cvc5" => Ok(Solver::CVC5),
2020
"boolector" => Ok(Solver::Boolector),
2121
"bitwuzla" => Ok(Solver::Bitwuzla),
22-
_ => {
23-
Err(format!("unknown solver: {s}. Known solvers are: z3, cvc5, boolector, bitwuzla"))
24-
}
22+
_ => Err(format!(
23+
"unknown solver: {s}. Known solvers are: z3, cvc5, boolector, bitwuzla"
24+
)),
2525
}
2626
}
2727
}

crates/filament/src/ir_passes/assume.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,17 @@ impl Assume {
7878
assert!(
7979
args.len() == 1,
8080
"Currently Unimplemented: {} requires {} arguments, automatic assumptions only implemented for single argument functions.",
81-
op, args.len()
81+
op,
82+
args.len()
8283
);
8384
Some((*op, *rhs, args[0]))
8485
}
8586
(_, ir::Expr::Fn { op, args }) => {
8687
assert!(
8788
args.len() == 1,
8889
"Currently Unimplemented: {} requires {} arguments, automatic assumptions only implemented for single argument functions.",
89-
op, args.len()
90+
op,
91+
args.len()
9092
);
9193
Some((*op, *lhs, args[0]))
9294
}

0 commit comments

Comments
 (0)