Skip to content

Commit

Permalink
Merge branch 'master' into tidy-calyx-py-correctness
Browse files Browse the repository at this point in the history
  • Loading branch information
anshumanmohan authored Jul 25, 2023
2 parents c44426f + 720b974 commit ea41043
Show file tree
Hide file tree
Showing 10 changed files with 445 additions and 387 deletions.
7 changes: 7 additions & 0 deletions calyx-py/calyx/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,13 @@ def seq_mem_d1(
name, ast.Stdlib.seq_mem_d1(bitwidth, len, idx_size), is_external, is_ref
)

def is_seq_mem_d1(self, cell: CellBuilder) -> bool:
"""Check if the cell is a SeqMemD1 cell."""
return (
isinstance(cell._cell.comp, ast.CompInst)
and cell._cell.comp.name == "seq_mem_d1"
)

def add(self, name: str, size: int, signed=False) -> CellBuilder:
"""Generate a StdAdd cell."""
self.prog.import_("primitives/binary_operators.futil")
Expand Down
45 changes: 45 additions & 0 deletions calyx-py/test/correctness/fifo.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"commands": {
"data": [
100,
0,
101,
102,
0,
103,
104,
105,
106,
107,
108,
0,
0,
0,
0
],
"format": {
"is_signed": false,
"numeric_type": "bitnum",
"width": 32
}
},
"ans_mem": {
"data": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"format": {
"is_signed": false,
"numeric_type": "bitnum",
"width": 32
}
}
}
31 changes: 31 additions & 0 deletions calyx-py/test/correctness/fifo.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"ans_mem": [
100,
101,
102,
103,
104,
105,
0,
0,
0,
0
],
"commands": [
100,
0,
101,
102,
0,
103,
104,
105,
106,
107,
108,
0,
0,
0,
0
]
}
Loading

0 comments on commit ea41043

Please sign in to comment.