Skip to content

Commit

Permalink
Added tests to import_tf package.
Browse files Browse the repository at this point in the history
  • Loading branch information
klayoutmatthias committed Oct 28, 2017
1 parent ad2614c commit 8146228
Show file tree
Hide file tree
Showing 9 changed files with 1,081 additions and 25 deletions.
9 changes: 2 additions & 7 deletions macros/import_tf.lym
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,10 @@
<interpreter>ruby</interpreter>
<dsl-interpreter-name/>
<text>#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# LICENSE file for details.
#
# DESCRIPTION: Cadence techfile import for KLayout.
#
Expand Down
11 changes: 3 additions & 8 deletions macros/import_tf_standalone.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
# $autorun
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# LICENSE file for details.
#
# DESCRIPTION: Cadence techfile converter for KLayout.
# DESCRIPTION: Cadence techfile converter for KLayout - batch mode interface
#
# Run the script with
# klayout -z -rd tf_file=[input] -rd lyp_file=[output] -r import_tf_standalone.lym ...
Expand Down
21 changes: 11 additions & 10 deletions ruby/import_tf.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# LICENSE file for details.
#
# DESCRIPTION: Cadence techfile import for KLayout.
# DESCRIPTION: Cadence techfile import for KLayout - core functionality.
#

module TechfileToKLayout
Expand All @@ -23,6 +18,7 @@ def initialize(_packet)
frame_color = 0x808080
fill_color = 0x808080
width = 1
xfill = false
end

attr_reader :packet
Expand All @@ -31,6 +27,7 @@ def initialize(_packet)
attr_accessor :frame_color
attr_accessor :fill_color
attr_accessor :width
attr_accessor :xfill

end

Expand Down Expand Up @@ -218,7 +215,7 @@ def self.import_techfile(lv, tf_file)
if sname == "drDefinePacket"
section.each do |defs|
if defs.length >= 6
packets[defs[1]] ||= [ defs[2], defs[3], defs[4], defs[5] ]
packets[defs[1]] ||= [ defs[2], defs[3], defs[4], defs[5], defs[6] ]
end
end
elsif sname == "drDefineLineStyle"
Expand Down Expand Up @@ -261,9 +258,10 @@ def self.import_techfile(lv, tf_file)
packets.each do |k,v|

stipple = stipples[v[0]]
line_style = line_styles[v[0]]
line_style = line_styles[v[1]]
fill_color = colors[v[2]]
frame_color = colors[v[3]]
xfill = v[4].to_s == "X"
width = widths[v[1]]
width ||= 0

Expand All @@ -273,6 +271,7 @@ def self.import_techfile(lv, tf_file)
dd.line_style = line_style
dd.fill_color = fill_color
dd.frame_color = frame_color
dd.xfill = xfill
dd.width = width
end

Expand Down Expand Up @@ -380,6 +379,8 @@ def self.import_techfile(lv, tf_file)
lprops.frame_color = ldef.display.frame_color
lprops.fill_color = ldef.display.fill_color
lprops.visible = ldef.visible
lprops.valid = ldef.valid
lprops.xfill = ldef.display.xfill
lprops.dither_pattern = ldef.display.stipple || 1
lprops.line_style = ldef.display.line_style || 0
lv.insert_layer(lv.end_layers, lprops)
Expand Down
323 changes: 323 additions & 0 deletions ruby/testdata_1/default.drf

Large diffs are not rendered by default.

140 changes: 140 additions & 0 deletions ruby/testdata_1/techfile.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@

;********************************
; LAYER DEFINITION
;********************************
layerDefinitions(

techPurposes(
;( PurposeName Purpose# Abbreviation )
;( ----------- -------- ------------ )
( drawing 252 drw )
( net 253 net )
) ;techPurposes

techLayers(
;( LayerName Layer# Abbreviation )
;( --------- ------ ------------ )
;User-Defined Layers:
( PW 1 PW )
( NBL 2 NBL )
( SP 3 SP )
( PBL 6 PBL )
( C1 9 C1 )
( M1 10 M1 )
( PA 11 PA )
( NW 12 NW )
( NHV 23 NHV )
( PHV 24 PHV )
( PTOP 25 PTOP )
( P1 30 P1 )
( P2 31 P2 )
( AA 54 AA )
( VTH 91 VTH )
( PP 97 PP )
( NP 98 NP )
) ;techLayers

techLayerPurposePriorities(
;layers are ordered from lowest to highest priority
;( LayerName Purpose )
;( --------- ------- )
( NBL drawing )
( PBL drawing )
( PW drawing )
( NW drawing )
( PTOP drawing )
( AA drawing )
( VTH drawing )
( P1 drawing )
( NHV drawing )
( PHV drawing )
( SP drawing )
( P2 drawing )
( NP drawing )
( PP drawing )
( C1 drawing )
( M1 drawing )
( PA drawing )
( P1 net )
( P2 net )
( C1 net )
( M1 net )
) ;techLayerPurposePriorities

techDisplays(
;( LayerName Purpose Packet Vis Sel Con2ChgLy DrgEnbl Valid )
;( --------- ------- ------ --- --- --------- ------- ----- )
( NBL drawing NBL t t t t t )
( PBL drawing PBL t t t t t )
( PW drawing PW t t t t t )
( NW drawing NW t t t t t )
( PTOP drawing PTOP t t t t t )
( AA drawing AA t t t t t )
( VTH drawing VTH t t t t t )
( P1 drawing P1 t t t t t )
( NHV drawing NHV t t t t t )
( PHV drawing PHV t t t t t )
( SP drawing SP t t t t t )
( P2 drawing P2 t t t t t )
( NP drawing NP t t t t t )
( PP drawing PP t t t t t )
( C1 drawing C1 t t t t t )
( M1 drawing M1 t t t t t )
( PA drawing PA t t t t t )
( P1 net P1net t t t t nil )
( P2 net P2net t t t t nil )
( C1 net C1net t t t t nil )
( M1 net M1net t t t t nil )
) ;techDisplays

techLayerProperties(
;( PropName Layer1 [ Layer2 ] PropValue )
)

) ;layerDefinitions


;********************************
; LAYER RULES
;********************************
layerRules(

streamLayers(
;( layer streamNumber dataType translate )
;( ----- ------------ -------- --------- )
( ("NBL" "drawing") 2 0 t )
( ("PBL" "drawing") 6 0 t )
( ("PW" "drawing") 1 0 t )
( ("NW" "drawing") 12 0 t )
( ("PTOP" "drawing") 25 0 t )
( ("AA" "drawing") 54 0 t )
( ("VTH" "drawing") 91 0 t )
( ("P1" "drawing") 30 0 t )
( ("NHV" "drawing") 23 0 t )
( ("PHV" "drawing") 24 0 t )
( ("SP" "drawing") 3 0 t )
( ("P2" "drawing") 31 0 t )
( ("NP" "drawing") 98 0 t )
( ("PP" "drawing") 97 0 t )
( ("C1" "drawing") 9 0 t )
( ("M1" "drawing") 10 0 t )
( ("PA" "drawing") 11 0 t )
( ("P2" "net") 101 0 t )
( ("P1" "net") 102 0 t )
( ("M1" "net") 103 0 t )
( ("C1" "net") 104 0 t )
) ;streamLayers

) ;layerRules


;********************************
; PHYSICAL RULES
;********************************
physicalRules(

mfgGridResolution(
( 0.001000 )
) ;mfgGridResolution

) ;physicalRules
Loading

0 comments on commit 8146228

Please sign in to comment.