summaryrefslogtreecommitdiff
path: root/library.rb
diff options
context:
space:
mode:
authorJulian Blake Kongslie2022-06-04 09:26:55 -0700
committerJulian Blake Kongslie2022-06-04 09:26:55 -0700
commitbcbef270884750fb7f55d5ab531655c14ba53444 (patch)
tree9008168cf99d627b0ed625ee530f18ba666a33de /library.rb
parentMake IC definitions more self-contained (diff)
downloadlace-bcbef270884750fb7f55d5ab531655c14ba53444.tar.xz
Named pins on subcomponents.
Diffstat (limited to '')
-rw-r--r--library.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/library.rb b/library.rb
index 1963b6e..bddcdea 100644
--- a/library.rb
+++ b/library.rb
@@ -30,7 +30,13 @@ def define_ic(name, value, pincount, *subparts, &automatic)
30 if parts.size < 1 30 if parts.size < 1
31 ic = comp("U", "#{$ic}-#{pincount}", name, value) 31 ic = comp("U", "#{$ic}-#{pincount}", name, value)
32 automatic.call(ic) 32 automatic.call(ic)
33 subs = subparts.map { | sub | sub.map { | pin | ic[pin] } } 33 subs = subparts.map do | sub |
34 if sub.respond_to?(:transform_values)
35 sub.transform_values { | pin | ic[pin] }
36 else
37 sub.map { | pin | ic[pin] }
38 end
39 end
34 subs.each do | sub | 40 subs.each do | sub |
35 if sub.size == 2 41 if sub.size == 2
36 parts << pair(*sub) 42 parts << pair(*sub)
@@ -45,8 +51,8 @@ end
45 51
46def stock_ic(name, value, &automatic) 52def stock_ic(name, value, &automatic)
47 case value 53 case value
48 when /74.*00/; define_ic(name, value, 14, [1, 2, 3], [4, 5, 6], [13, 12, 11], [10, 9, 8], &automatic) 54 when /74\D*00$/; define_ic(name, value, 14, {a: 1, b: 2, y: 3}, {a: 4, b: 5, y: 6}, {a: 13, b: 12, y: 11}, {a: 10, b: 9, y: 8}, &automatic)
49 when /74.*04/; define_ic(name, value, 14, [1, 2], [3, 4], [5, 6], [13, 12], [11, 10], [9, 8], &automatic) 55 when /74\D*04$/; define_ic(name, value, 14, [1, 2], [3, 4], [5, 6], [13, 12], [11, 10], [9, 8], &automatic)
50 end 56 end
51end 57end
52 58