Skip to content

Commit 70d52c2

Browse files
authored
Make is_memory property more sensitive for cells and libcells by also matching on memory groups (#129)
* Add `has_memory` property * Whitespace fixes * Remove unused argument name * Review fixes * Move gf180mcu_sram.lib.gz from examples/ to test/ * Fix tcl script * Switch to is_memory * Remove is_memory_cell
1 parent 3c461f2 commit 70d52c2

10 files changed

Lines changed: 76 additions & 1 deletion

doc/OpenSTA.odt

88 Bytes
Binary file not shown.

doc/OpenSTA.pdf

-402 Bytes
Binary file not shown.

liberty/LibertyReader.cc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,10 @@ LibertyReader::defineVisitors()
373373
&LibertyReader::visitLevelShifterDataPin);
374374
defineAttrVisitor("switch_pin", &LibertyReader::visitSwitchPin);
375375

376+
// Memory
377+
defineGroupVisitor("memory", &LibertyReader::beginMemory,
378+
&LibertyReader::endMemory);
379+
376380
// Register/latch
377381
defineGroupVisitor("ff", &LibertyReader::beginFF, &LibertyReader::endFF);
378382
defineGroupVisitor("ff_bank", &LibertyReader::beginFFBank,
@@ -3851,6 +3855,21 @@ LibertyReader::visitPortBoolAttr(LibertyAttr *attr,
38513855

38523856
////////////////////////////////////////////////////////////////
38533857

3858+
void
3859+
LibertyReader::beginMemory(LibertyGroup *)
3860+
{
3861+
if (cell_) {
3862+
cell_->setIsMemory(true);
3863+
}
3864+
}
3865+
3866+
void
3867+
LibertyReader::endMemory(LibertyGroup *)
3868+
{
3869+
}
3870+
3871+
////////////////////////////////////////////////////////////////
3872+
38543873
void
38553874
LibertyReader::beginFF(LibertyGroup *group)
38563875
{

liberty/LibertyReaderPvt.hh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ public:
291291
virtual void endWireloadSelection(LibertyGroup *group);
292292
virtual void visitWireloadFromArea(LibertyAttr *attr);
293293

294+
virtual void beginMemory(LibertyGroup *group);
295+
virtual void endMemory(LibertyGroup *group);
296+
294297
virtual void beginFF(LibertyGroup *group);
295298
virtual void endFF(LibertyGroup *group);
296299
virtual void beginFFBank(LibertyGroup *group);

search/Property.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,8 @@ getProperty(const LibertyCell *cell,
726726
return PropertyValue(cell->isBuffer());
727727
else if (stringEqual(property, "is_inverter"))
728728
return PropertyValue(cell->isInverter());
729+
else if (stringEqual(property, "is_memory"))
730+
return PropertyValue(cell->isMemory());
729731
else if (stringEqual(property, "dont_use"))
730732
return PropertyValue(cell->dontUse());
731733
else if (stringEqual(property, "area"))
@@ -957,7 +959,7 @@ getProperty(const Instance *inst,
957959
return PropertyValue(liberty_cell && liberty_cell->isInverter());
958960
else if (stringEqual(property, "is_macro"))
959961
return PropertyValue(liberty_cell && liberty_cell->isMacro());
960-
else if (stringEqual(property, "is_memory_cell"))
962+
else if (stringEqual(property, "is_memory"))
961963
return PropertyValue(liberty_cell && liberty_cell->isMemory());
962964
else
963965
throw PropertyUnknown("instance", property);

test/get_is_memory.ok

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[get_cells -filter is_memory]
2+
sram_inst
3+
[get_lib_cells -filter is_memory]
4+
gf180mcu_fd_ip_sram__sram128x8m8wm1__ff_125C_1v98/gf180mcu_fd_ip_sram__sram128x8m8wm1

test/get_is_memory.tcl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Tests whether the is_memory attribute works for cells and libcells
2+
read_liberty gf180mcu_sram.lib.gz
3+
read_liberty asap7_small.lib.gz
4+
read_verilog get_is_memory.v
5+
link get_is_memory
6+
7+
# Test that the is_memory attribute is set correctly for cells
8+
puts {[get_cells -filter is_memory]}
9+
report_object_full_names [get_cells -filter is_memory]
10+
puts {[get_lib_cells -filter is_memory]}
11+
report_object_full_names [get_lib_cells -filter is_memory]

test/get_is_memory.v

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
module get_is_memory (
2+
input CLK,
3+
input CEN,
4+
input GWEN,
5+
input [7:0] WEN,
6+
input [6:0] A,
7+
input [7:0] D,
8+
output [7:0] Q
9+
);
10+
11+
wire CEN_buf;
12+
wire GWEN_reg;
13+
14+
BUFx2_ASAP7_75t_R buf_inst (
15+
.A(CEN),
16+
.Y(CEN_buf)
17+
);
18+
19+
DFFHQx4_ASAP7_75t_R dff_inst (
20+
.CLK(CLK),
21+
.D(GWEN),
22+
.Q(GWEN_reg)
23+
);
24+
25+
gf180mcu_fd_ip_sram__sram128x8m8wm1 sram_inst (
26+
.CLK(CLK),
27+
.CEN(CEN_buf),
28+
.GWEN(GWEN_reg),
29+
.WEN(WEN),
30+
.A(A),
31+
.D(D),
32+
.Q(Q)
33+
);
34+
35+
endmodule

test/gf180mcu_sram.lib.gz

6.85 KB
Binary file not shown.

test/regression_vars.tcl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ record_sta_tests {
126126
verilog_attribute
127127
liberty_arcs_one2one_1
128128
liberty_arcs_one2one_2
129+
get_is_memory
129130
get_filter
130131
get_noargs
131132
get_objrefs

0 commit comments

Comments
 (0)