Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/dbSta/include/db_sta/dbSta.hh
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ class dbSta : public Sta, public odb::dbDatabaseObserver

float slack(const odb::dbNet* net, const MinMax* min_max);

// Copy the user/SAIF/VCD activity annotated on from to to, for netlist
// edits that replace a pin with an equivalent one.
void copyUserActivity(odb::dbITerm* from, odb::dbITerm* to);

// From ord::OpenRoad::Observer
void postReadLef(odb::dbTech* tech, odb::dbLib* library) override;
void postReadDef(odb::dbBlock* block) override;
Expand Down
13 changes: 13 additions & 0 deletions src/dbSta/src/dbSta.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "odb/dbBlockCallBackObj.h"
#include "odb/dbObject.h"
#include "odb/dbTypes.h"
#include "power/Power.hh"
#include "sta/ArcDelayCalc.hh"
#include "sta/Clock.hh"
#include "sta/Delay.hh"
Expand Down Expand Up @@ -500,6 +501,18 @@ float dbSta::slack(const odb::dbNet* db_net, const MinMax* min_max)
return slack(net, min_max);
}

void dbSta::copyUserActivity(odb::dbITerm* from, odb::dbITerm* to)
{
const Pin* from_pin = db_network_->dbToSta(from);
if (power()->hasUserActivity(from_pin)) {
const PwrActivity& activity = power()->userActivity(from_pin);
power()->setUserActivity(db_network_->dbToSta(to),
activity.density(),
activity.duty(),
activity.origin());
}
}
Comment thread
maliberty marked this conversation as resolved.
Resolved

odb::PtrSet<odb::dbNet> dbSta::findClkNets()
{
return findClkNets(cmdMode());
Expand Down
5 changes: 3 additions & 2 deletions src/dft/src/replace/ScanReplace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ void ScanReplace::scanReplace(odb::dbBlock* block)
odb::dbMaster* master_scan_cell = db_network_->staToDb(scan_cell);

odb::dbInst* new_cell = utils::ReplaceCell(
block, inst, master_scan_cell, scan_candidate->getPortMapping());
sta_, block, inst, master_scan_cell, scan_candidate->getPortMapping());

already_replaced.insert(new_cell);
addCellForRollback(master, master_scan_cell, scan_candidate);
Expand Down Expand Up @@ -637,7 +637,8 @@ void ScanReplace::rollbackScanReplace(odb::dbBlock* block)
}

RollbackCandidate& rollback_candidate = *found->second;
utils::ReplaceCell(block,
utils::ReplaceCell(sta_,
block,
inst,
rollback_candidate.getMaster(),
rollback_candidate.getPortMapping());
Expand Down
12 changes: 12 additions & 0 deletions src/dft/src/utils/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ bool IsSequentialCell(sta::dbNetwork* db_network, odb::dbInst* instance)
}

odb::dbInst* ReplaceCell(
sta::dbSta* sta,
odb::dbBlock* top_block,
odb::dbInst* old_instance,
odb::dbMaster* new_master,
Expand Down Expand Up @@ -120,6 +121,17 @@ odb::dbInst* ReplaceCell(
}
}

// Keep the activity annotations of the old pins on the new pins
for (odb::dbITerm* old_iterm : old_instance->getITerms()) {
auto mapped = port_mapping.find(old_iterm->getMTerm()->getName());
if (mapped != port_mapping.end()) {
odb::dbITerm* new_iterm = new_instance->findITerm(mapped->second.c_str());
if (new_iterm) {
sta->copyUserActivity(old_iterm, new_iterm);
}
}
}
Comment thread
maliberty marked this conversation as resolved.
Resolved

// Delete the old cell
odb::dbInst::destroy(old_instance);

Expand Down
2 changes: 2 additions & 0 deletions src/dft/src/utils/Utils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ namespace dft::utils {
// cell will be preserved by using the given port mapping from
// <old_port_name, new_port_name>. Returns the new instance and deletes the old
// one. The name of the new instance is going to be the same as the old one.
// User/SAIF/VCD activity of the old pins is copied to the mapped new pins.
odb::dbInst* ReplaceCell(
sta::dbSta* sta,
odb::dbBlock* top_block,
odb::dbInst* old_instance,
odb::dbMaster* new_master,
Expand Down
4 changes: 4 additions & 0 deletions src/dft/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ COMPULSORY_TESTS = [
"scan_architect_clock_mix_sky130",
"scan_architect_no_mix_sky130",
"scan_architect_register_bank_no_clock_mix_sky130",
"scan_replace_activity_sky130",
"scan_replace_dont_use_sky130",
"scandef_core_sky130",
"scandef_sky130",
Expand Down Expand Up @@ -51,6 +52,9 @@ filegroup(
"scan_architect_register_bank_no_clock_mix_sky130": [
"register_bank_top.v",
],
"scan_replace_activity_sky130": [
"one_cell_sky130.def",
],
"scan_replace_dont_use_sky130": [
"one_cell_sky130.def",
],
Expand Down
23 changes: 23 additions & 0 deletions src/dft/test/scan_replace_activity_sky130.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[INFO ODB-0227] LEF file: sky130hd/sky130hd.tlef, created 13 layers, 25 vias
[INFO ODB-0227] LEF file: sky130hd/sky130_fd_sc_hd_merged.lef, created 437 library cells
[INFO ODB-0128] Design: one_cell
[INFO ODB-0130] Created 4 pins.
[INFO ODB-0131] Created 1 components and 6 component-terminals.
[INFO ODB-0133] Created 4 nets and 4 connections.
Instance ff1
Cell: sky130_fd_sc_hd__sdfstp_1
Library: sky130_fd_sc_hd_merged
Path cells: sky130_fd_sc_hd__sdfstp_1
Input pins:
D input port1
SCD input (unconnected)
SCE input (unconnected)
SET_B input set_b
CLK input clock
Output pins:
Q output output1
input 1
unannotated 9
Annotated pins:
user ff1/Q
ff1/Q 2.50000e+07 0.500 user
16 changes: 16 additions & 0 deletions src/dft/test/scan_replace_activity_sky130.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# scan_replace keeps the activity annotation of the replaced flop's pins
source "helpers.tcl"

read_lef sky130hd/sky130hd.tlef
read_lef sky130hd/sky130_fd_sc_hd_merged.lef
read_liberty sky130hd/sky130_fd_sc_hd__tt_025C_1v80.lib

read_def one_cell_sky130.def

create_clock -name main_clock -period 2.0000 -waveform {0.0000 1.0000} [get_ports {clock}]

set_power_activity -pins [get_pins ff1/Q] -activity 0.05
scan_replace
report_instance ff1
report_activity_annotation -report_annotated
puts "ff1/Q [get_property [get_pins ff1/Q] activity]"
3 changes: 3 additions & 0 deletions src/gpl/src/mbff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,9 @@ void MBFF::ModifyPinConnections(const std::vector<Flop>& flops,
}
}
if (tray_iterm) {
// Keep the activity annotation of the flop pin on the tray pin.
sta_->copyUserActivity(iterm, tray_iterm);

const std::string val = orig_inst_name + "/" + orig_port_name;
odb::dbStringProperty* prop
= odb::dbStringProperty::find(tray_iterm, kOrigNameProp);
Expand Down
1 change: 1 addition & 0 deletions src/gpl/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ TESTS = [
"diverge01",
"error01",
"incremental01",
"mbff_activity",
"mbff_hier",
"mbff_orig_name",
"mbff_clock_power_off",
Expand Down
37 changes: 37 additions & 0 deletions src/gpl/test/mbff_activity.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[INFO ODB-0227] LEF file: ./asap7/asap7_tech_1x_201209.lef, created 30 layers, 9 vias
[INFO ODB-0227] LEF file: ./SingleBit/asap7sc7p5t_28_L_1x_220121a.lef, created 212 library cells
[INFO ODB-0227] LEF file: ./4BitTrayH4/asap7sc7p5t_DFFHQNV4X.lef, created 9 library cells
[WARNING IFP-0028] Core area lower left (1.000, 1.000) snapped to (1.026, 1.080).
[INFO IFP-0001] Added 29 rows of 147 site asap7sc7p5t.
[INFO IFP-0100] Die BBox: ( 0.000 0.000 ) ( 10.000 10.000 ) um
[INFO IFP-0101] Core BBox: ( 1.026 1.080 ) ( 8.964 8.910 ) um
[INFO IFP-0102] Core area: 62.155 um^2
[INFO IFP-0103] Total instances area: 1.166 um^2
[INFO IFP-0104] Effective utilization: 0.019
[INFO IFP-0105] Number of instances: 4
Alpha = 40.0, Beta = 1.0, #paths = 0, max size = -1
Total ILP Cost: 112.644
Total Timing Critical Path Displacement: 0.0
Average slot-to-flop displacement: 1.730
Final Objective Value: 112.644
Sizes used
4-bit: 1
input 8
unannotated 10
Annotated pins:
user _tray_size4_7/D0
user _tray_size4_7/D1
user _tray_size4_7/D2
user _tray_size4_7/D3
user _tray_size4_7/QN0
user _tray_size4_7/QN1
user _tray_size4_7/QN2
user _tray_size4_7/QN3
_tray_size4_7/D0 8.00000e+07 0.500 user
_tray_size4_7/D1 7.00000e+07 0.500 user
_tray_size4_7/D2 5.00000e+07 0.500 user
_tray_size4_7/D3 6.00000e+07 0.500 user
_tray_size4_7/QN0 4.00000e+07 0.500 user
_tray_size4_7/QN1 3.00000e+07 0.500 user
_tray_size4_7/QN2 1.00000e+07 0.500 user
_tray_size4_7/QN3 2.00000e+07 0.500 user
41 changes: 41 additions & 0 deletions src/gpl/test/mbff_activity.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# cluster_flops keeps the activity annotation of each flop pin on its tray pin
source helpers.tcl

read_lef ./asap7/asap7_tech_1x_201209.lef
read_lef ./SingleBit/asap7sc7p5t_28_L_1x_220121a.lef
read_liberty ./SingleBit/asap7sc7p5t_SEQ_LVT_TT_nldm_220123.lib
read_lef ./4BitTrayH4/asap7sc7p5t_DFFHQNV4X.lef
read_liberty ./4BitTrayH4/asap7sc7p5t_DFFHQNV4X_LVT_TT_nldm_FAKE.lib

read_verilog ./mbff_orig_name.v
link_design tray_test

initialize_floorplan -die_area "0 0 10 10" \
-core_area "1 1 9 9" \
-site asap7sc7p5t

place_inst -name ff1 -origin {6 6} -status PLACED
place_inst -name ff2 -origin {4 6} -status PLACED
place_inst -name ff3 -origin {4 4} -status PLACED
place_inst -name ff4 -origin {6 4} -status PLACED

create_clock -name clk -period 1000 [get_ports clk1]

set_power_activity -pins [get_pins ff1/QN] -activity 0.01
set_power_activity -pins [get_pins ff2/QN] -activity 0.02
set_power_activity -pins [get_pins ff3/QN] -activity 0.03
set_power_activity -pins [get_pins ff4/QN] -activity 0.04
set_power_activity -pins [get_pins ff1/D] -activity 0.05
set_power_activity -pins [get_pins ff2/D] -activity 0.06
set_power_activity -pins [get_pins ff3/D] -activity 0.07
set_power_activity -pins [get_pins ff4/D] -activity 0.08

cluster_flops -tray_weight 40.0 \
-timing_weight 1.0 \
-max_split_size -1 \
-num_paths 0

report_activity_annotation -report_annotated
foreach pin [get_pins {_tray_size4_*/D* _tray_size4_*/QN*}] {
puts "[get_full_name $pin] [get_property $pin activity]"
}
Loading