Skip to content

Commit

Permalink
ensure that @external memories are std_mem_d1 (#1605)
Browse files Browse the repository at this point in the history
  • Loading branch information
rachitnigam authored Jul 16, 2023
1 parent 267b0d1 commit 2137cf0
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/backend/xilinx/toplevel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,22 @@ impl Backend for XilinxInterfaceBackend {
}
}

fn external_memories_cells(
comp: &ir::Component,
) -> Vec<calyx_ir::RRC<ir::Cell>> {
fn external_memories_cells(comp: &ir::Component) -> Vec<ir::RRC<ir::Cell>> {
comp.cells
.iter()
// find external memories
.filter(|cell_ref| {
cell_ref.borrow().attributes.has(ir::BoolAttr::External)
let cell = cell_ref.borrow();
// NOTE(rachit): We only support one dimensional std_mem_d1 memories
if cell.attributes.has(ir::BoolAttr::External) {
if !cell.is_primitive(Some("std_mem_d1")) {
panic!("cell `{}' marked with `@external' but is not a std_mem_d1. The AXI generator currently only supports `std_mem_d1'", cell.name())
} else {
true
}
} else {
false
}
})
.cloned()
.collect()
Expand Down

0 comments on commit 2137cf0

Please sign in to comment.