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
3 changes: 3 additions & 0 deletions src/odb/src/cdl/cdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ readMasters(utl::Logger* logger, dbBlock* block, const char* fileName)
}
mterms = &mtermMap[master];
} else {
// Replace CDL <> (normal and escaped) to []
token = std::regex_replace(token, std::regex(R"(\\?<)"), "[");
token = std::regex_replace(token, std::regex(R"(\\?>)"), "]");
dbMTerm* mterm = master->findMTerm(token.c_str());
if (!mterm) {
logger->warn(utl::ODB,
Expand Down
4 changes: 4 additions & 0 deletions src/odb/test/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ COMPULSORY_TESTS = [
"smash_vias",
"transform",
"wire_encoder",
"write_cdl",
"write_def58",
"write_def58_gzip",
"write_lef_and_def",
Expand Down Expand Up @@ -344,6 +345,9 @@ filegroup(
"replace_hier_mod4": [
"gcd_abstract_lef.lefok",
],
"write_cdl": [
"write_cdl_escaped.cdl",
],
}.get(
test_name,
[],
Expand Down
1 change: 1 addition & 0 deletions src/odb/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ or_integration_tests(
smash_vias
transform
wire_encoder
write_cdl
write_def58
write_def58_gzip
write_lef_and_def
Expand Down
27 changes: 27 additions & 0 deletions src/odb/test/write_cdl.cdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
*.BIPOLAR
*.RESI = 2000
*.RESVAL
*.CAPVAL
*.DIOPERI
*.DIOAREA
*.EQUATION
*.SCALE METER
*.MEGA
.PARAM
*.EXPAND_ON_M_FACTOR

.SUBCKT BUFFER A Z inh_gnd inh_vdd
*.PININFO A:I Z:O inh_gnd:B inh_vdd:B
MM0 netx A inh_vdd inh_vdd P250 W=1e-6 L=1e-6 M=1 ngcon=1 nfing=1 srcefirst=1
MM1 Z netx inh_vdd inh_vdd P250 W=1e-6 L=1e-6 M=1 ngcon=1 nfing=1 srcefirst=1
MMN1 netx A inh_gnd inh_gnd N250 W=1u L=1u M=1 ngcon=1 nfing=1 srcefirst=1
MMN10 Z netx inh_gnd inh_gnd N250 W=1u L=1u M=1 ngcon=1 nfing=1 srcefirst=1
.ENDS

.SUBCKT MACRO_CELL IN_REG<0> IN_REG<1> OUT_REG<0> OUT_REG<1> VDD GND
*.PININFO IN_REG<0>:I IN_REG<1>:I
*.PININFO OUT_REG<0>:O OUT_REG<1>:O
*.PININFO VDD:B GND:B
BUFFER IN_REG<0> OUT_REG<0> VDD GND / buffer0
BUFFER IN_REG<1> OUT_REG<1> VDD GND / buffer1
.ENDS
8 changes: 8 additions & 0 deletions src/odb/test/write_cdl.cdlok
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
* CDL Netlist generated by OpenROAD

*.BUSDELIMITER [

.SUBCKT top in_reg[0] in_reg[1] out_reg[0] out_reg[1]
Xi_macro in_reg[0] in_reg[1] out_reg[0] out_reg[1] _unconnected_0
+ _unconnected_1 MACRO_CELL
.ENDS top
82 changes: 82 additions & 0 deletions src/odb/test/write_cdl.lef
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
VERSION 5.8 ;
BUSBITCHARS "[]" ;
DIVIDERCHAR "/" ;
UNITS
DATABASE MICRONS 1000 ;
END UNITS

MANUFACTURINGGRID 0.005 ;

USEMINSPACING OBS OFF ;

PROPERTYDEFINITIONS
LAYER LEF58_TYPE STRING ;
LAYER LEF58_SPACING STRING ;
LAYER LEF58_WIDTH STRING ;
LAYER LEF58_AREA STRING ;
LAYER LEF58_MINENCLOSEDAREA STRING ;
END PROPERTYDEFINITIONS

LAYER metal1
TYPE ROUTING ;
DIRECTION HORIZONTAL ;
PITCH 1 ;
WIDTH 1 ;
END metal1

MACRO MACRO_CELL
CLASS BLOCK ;
ORIGIN 0 0 ;
SIZE 10 BY 10 ;
SYMMETRY X Y R90 ;
PIN VDD
DIRECTION INPUT ;
USE SIGNAL ;
PORT
LAYER metal1 ;
RECT 0 5 0 5 ;
END
END VDD
PIN GND
DIRECTION INPUT ;
USE SIGNAL ;
PORT
LAYER metal1 ;
RECT 0 5 0 5 ;
END
END GND
PIN IN_REG[0]
DIRECTION INPUT ;
USE SIGNAL ;
PORT
LAYER metal1 ;
RECT 0 5 0 5 ;
END
END IN_REG[0]
PIN IN_REG[1]
DIRECTION INPUT ;
USE SIGNAL ;
PORT
LAYER metal1 ;
RECT 0 5 0 5 ;
END
END IN_REG[1]
PIN OUT_REG[0]
DIRECTION INPUT ;
USE SIGNAL ;
PORT
LAYER metal1 ;
RECT 0 5 0 5 ;
END
END OUT_REG[0]
PIN OUT_REG[1]
DIRECTION INPUT ;
USE SIGNAL ;
PORT
LAYER metal1 ;
RECT 0 5 0 5 ;
END
END OUT_REG[1]
END MACRO_CELL

END LIBRARY
58 changes: 58 additions & 0 deletions src/odb/test/write_cdl.lib
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
library(MACRO_CELL){

input_threshold_pct_fall : 60;
input_threshold_pct_rise : 40;
output_threshold_pct_fall : 60;
output_threshold_pct_rise : 40;
slew_lower_threshold_pct_fall : 10;
slew_lower_threshold_pct_rise : 10;
slew_upper_threshold_pct_fall : 90;
slew_upper_threshold_pct_rise : 90;

type(bus_1_0){
base_type : array;
bit_from : 1;
bit_to : 0;
bit_width : 2;
data_type : bit;
downto : true;
}

cell(MACRO_CELL){
is_macro_cell : true;
pg_pin(GND){
pg_type : primary_ground;
}
pg_pin(VDD){
pg_type : primary_power;
}
bus(IN_REG){
bus_type : bus_1_0;
direction : input;
pin(IN_REG[0]){
direction : input;
related_ground_pin : GNDD;
related_power_pin : VDDD;
}
pin(IN_REG[1]){
direction : input;
related_ground_pin : GNDD;
related_power_pin : VDDD;
}
}
bus(OUT_REG){
bus_type : bus_1_0;
direction : output;
pin(OUT_REG[0]){
direction : output;
related_ground_pin : GNDD;
related_power_pin : VDDD;
}
pin(OUT_REG[1]){
direction : output;
related_ground_pin : GNDD;
related_power_pin : VDDD;
}
}
}
}
5 changes: 5 additions & 0 deletions src/odb/test/write_cdl.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[INFO ODB-0227] LEF file: write_cdl.lef, created 1 layers, 1 library cells
[WARNING ODB-0284] Master BUFFER not found.
[WARNING ODB-0284] Master BUFFER not found.
No differences found.
No differences found.
18 changes: 18 additions & 0 deletions src/odb/test/write_cdl.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
source "helpers.tcl"

read_lef write_cdl.lef
read_liberty write_cdl.lib

read_verilog write_cdl.v

link_design top

set cdl_file [make_result_file write_cdl_out.cdl]
write_cdl -masters {write_cdl.cdl} $cdl_file

set cdl_escaped_file [make_result_file write_cdl_escaped_out.cdl]
write_cdl -masters {write_cdl_escaped.cdl} $cdl_escaped_file

diff_files write_cdl.cdlok $cdl_file

diff_files write_cdl.cdlok $cdl_escaped_file
8 changes: 8 additions & 0 deletions src/odb/test/write_cdl.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module top ( in_reg, out_reg );
output [1:0] in_reg;
output [1:0] out_reg;
MACRO_CELL i_macro (
.IN_REG(in_reg),
.OUT_REG(out_reg)
);
endmodule
27 changes: 27 additions & 0 deletions src/odb/test/write_cdl_escaped.cdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
*.BIPOLAR
*.RESI = 2000
*.RESVAL
*.CAPVAL
*.DIOPERI
*.DIOAREA
*.EQUATION
*.SCALE METER
*.MEGA
.PARAM
*.EXPAND_ON_M_FACTOR

.SUBCKT BUFFER A Z inh_gnd inh_vdd
*.PININFO A:I Z:O inh_gnd:B inh_vdd:B
MM0 netx A inh_vdd inh_vdd P250 W=1e-6 L=1e-6 M=1 ngcon=1 nfing=1 srcefirst=1
MM1 Z netx inh_vdd inh_vdd P250 W=1e-6 L=1e-6 M=1 ngcon=1 nfing=1 srcefirst=1
MMN1 netx A inh_gnd inh_gnd N250 W=1u L=1u M=1 ngcon=1 nfing=1 srcefirst=1
MMN10 Z netx inh_gnd inh_gnd N250 W=1u L=1u M=1 ngcon=1 nfing=1 srcefirst=1
.ENDS

.SUBCKT MACRO_CELL IN_REG\<0\> IN_REG\<1\> OUT_REG\<0\> OUT_REG\<1\> VDD GND
*.PININFO IN_REG\<0\>:I IN_REG\<1\>:I
*.PININFO OUT_REG\<0\>:O OUT_REG\<1\>:O
*.PININFO VDD:B GND:B
BUFFER IN_REG\<0\> OUT_REG\<0\> VDD GND / buffer0
BUFFER IN_REG\<1\> OUT_REG\<1\> VDD GND / buffer1
.ENDS