From ea6799b76460739e9664d2cbbac38aa5748ea0a2 Mon Sep 17 00:00:00 2001 From: colin Date: Thu, 10 Nov 2022 01:23:02 +0000 Subject: [PATCH] app: stacked_cores: new 57-xx experiment: complementary buffer with doubled inputs --- .../stacked_cores/scripts/plot_57xx.py | 34 ++++ .../scripts/stacked_cores_52xx.py | 4 +- .../scripts/stacked_cores_52xx_db.py | 188 ++++++++++++++++++ crates/applications/stacked_cores/src/main.rs | 169 +++++++++++++++- 4 files changed, 393 insertions(+), 2 deletions(-) create mode 100755 crates/applications/stacked_cores/scripts/plot_57xx.py diff --git a/crates/applications/stacked_cores/scripts/plot_57xx.py b/crates/applications/stacked_cores/scripts/plot_57xx.py new file mode 100755 index 0000000..3220ce7 --- /dev/null +++ b/crates/applications/stacked_cores/scripts/plot_57xx.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 + +from natsort import natsorted + +from stacked_cores_52xx import * +from stacked_cores_52xx_plotters import * + + +def extract_57xx_tx(meas_rows: list) -> tuple: + """ + extracts a flat tuple of input/output M mappings from a 57xx run + """ + + return ( + meas_rows[0].m[0], # input + meas_rows[1].m[1], # output + meas_rows[0].m[2], # input + meas_rows[0].m[3], # input + meas_rows[1].m[4], # output + meas_rows[0].m[5], # input + ) + + +buf_gates = read_db(lambda name: name.startswith("57-")) + +sweep_buf_inputs = lambda points=101: [(m, None, m, -m, None, -m) for m in sweep_1d(points)] +sweep_pos_input = lambda mneg, points=101: [(m, None, m, mneg, None, mneg) for m in sweep_1d(points)] + + +for name, meas in natsorted(buf_gates.items()): + # trace = eval_series(meas, sweep_buf_inputs(41), extract_57xx_tx, y_idx=1) + trace = eval_series(meas, sweep_pos_input(0, 41), extract_57xx_tx, y_idx=1) + plot(f"{name}", "a1", trace) + plot_slope(f"slope {name}", "a1", trace) diff --git a/crates/applications/stacked_cores/scripts/stacked_cores_52xx.py b/crates/applications/stacked_cores/scripts/stacked_cores_52xx.py index 86808b8..b7acdb6 100755 --- a/crates/applications/stacked_cores/scripts/stacked_cores_52xx.py +++ b/crates/applications/stacked_cores/scripts/stacked_cores_52xx.py @@ -11,7 +11,7 @@ from stacked_cores_52xx_db import DB ## CONSTANTS/CONFIGURATION # list of sims to extract details for -PREFIXES = { "52", "53", "54", "55", "56" } +PREFIXES = { "52", "53", "54", "55", "56", "57" } def times_of_interest(sim_name: str) -> list: # could be more intelligent, extracting e.g. the clock duration from the name @@ -25,6 +25,8 @@ def times_of_interest(sim_name: str) -> list: return [4e-9, 6e-9, 10e-9] if sim_name.startswith("56-"): return [4e-9, 6e-9] + if sim_name.startswith("57-"): + return [4e-9, 6e-9] ## USER-FACING FUNCTIONS diff --git a/crates/applications/stacked_cores/scripts/stacked_cores_52xx_db.py b/crates/applications/stacked_cores/scripts/stacked_cores_52xx_db.py index 893d8e8..4e75c95 100644 --- a/crates/applications/stacked_cores/scripts/stacked_cores_52xx_db.py +++ b/crates/applications/stacked_cores/scripts/stacked_cores_52xx_db.py @@ -2100,4 +2100,192 @@ DB = { MeasRow(6e-09, [-30938, -30916, 7992, -16652, -30929, -30941]), ], }), + '57-buf-0.0004rad-2000ctl_cond-20000coupling_cond-2000ps-100ps-3ctl-3coupling-5_1_5_1_winding-49999998976e0-drive-': ParameterizedMeas({ + (-1.000, -1.000,): [ + MeasRow(4e-09, [-17547, -17885, -17568, -17545, -17884, -17563]), + MeasRow(6e-09, [-29672, -7295, -29774, -29731, -7233, -29699]), + ], + (-1.000, 1.000,): [ + MeasRow(4e-09, [-17548, -17583, -17557, 16974, -17037, 16998]), + MeasRow(6e-09, [-29672, -15183, -29806, -29604, 16436, -29636]), + ], + ( 0.000, 0.000,): [ + MeasRow(4e-09, [ 7126, -17171, 7854, 7052, -17172, 8191]), + MeasRow(6e-09, [-29593, 4689, -29752, -29654, 5138, -29662]), + ], + ( 0.020, -0.020,): [ + MeasRow(4e-09, [ 9416, -17171, 9798, 1634, -17165, 1703]), + MeasRow(6e-09, [-29587, 8706, -29744, -29663, -768, -29675]), + ], + ( 0.050, -0.050,): [ + MeasRow(4e-09, [ 15647, -17193, 15673, -16484, -17322, -16440]), + MeasRow(6e-09, [-29546, 16174, -29712, -29734, -14815, -29710]), + ], + ( 0.070, -0.070,): [ + MeasRow(4e-09, [ 16288, -17200, 16299, -17021, -17393, -17005]), + MeasRow(6e-09, [-29549, 16284, -29716, -29734, -14948, -29708]), + ], + ( 0.100, -0.100,): [ + MeasRow(4e-09, [ 16454, -17198, 16466, -17137, -17413, -17122]), + MeasRow(6e-09, [-29550, 16298, -29717, -29735, -14958, -29708]), + ], + ( 0.150, -0.150,): [ + MeasRow(4e-09, [ 16592, -17193, 16610, -17235, -17428, -17224]), + MeasRow(6e-09, [-29549, 16310, -29717, -29737, -14965, -29708]), + ], + ( 0.200, -0.200,): [ + MeasRow(4e-09, [ 16661, -17182, 16677, -17284, -17440, -17276]), + MeasRow(6e-09, [-29548, 16324, -29716, -29737, -14979, -29708]), + ], + ( 0.250, -0.250,): [ + MeasRow(4e-09, [ 16711, -17166, 16721, -17318, -17450, -17315]), + MeasRow(6e-09, [-29547, 16351, -29714, -29735, -15013, -29707]), + ], + ( 1.000, -1.000,): [ + MeasRow(4e-09, [ 16975, -17034, 16990, -17550, -17581, -17563]), + MeasRow(6e-09, [-29544, 16394, -29713, -29739, -15064, -29709]), + ], + }), + '57-buf-0.0004rad-2000ctl_cond-20000coupling_cond-2000ps-100ps-6ctl-6coupling-3_1_3_1_winding-2e9-drive-': ParameterizedMeas({ + (-1.000, -1.000,): [ + MeasRow(4e-09, [-17685, -18261, -17678, -17685, -18261, -17679]), + MeasRow(6e-09, [-27202, -12326, -27205, -27202, -12323, -27207]), + ], + (-1.000, 1.000,): [ + MeasRow(4e-09, [-17703, -17968, -17699, 16861, -16877, 16858]), + MeasRow(6e-09, [-27202, -14593, -27218, -27190, 3017, -27197]), + ], + ( 0.000, 0.000,): [ + MeasRow(4e-09, [ 105, -17221, 149, 104, -17220, 156]), + MeasRow(6e-09, [-27187, -4616, -27187, -27187, -4588, -27191]), + ], + ( 0.100, -0.100,): [ + MeasRow(4e-09, [ 951, -17224, 1011, 68, -17220, 80]), + MeasRow(6e-09, [-27187, -4263, -27187, -27187, -4673, -27191]), + ], + ( 0.200, -0.200,): [ + MeasRow(4e-09, [ 3443, -17230, 3476, 9, -17220, 11]), + MeasRow(6e-09, [-27187, -3294, -27186, -27187, -4850, -27191]), + ], + ( 1.000, -1.000,): [ + MeasRow(4e-09, [ 16860, -16876, 16860, -17705, -17967, -17698]), + MeasRow(6e-09, [-27189, 2975, -27192, -27215, -14595, -27207]), + ], + }), + '57-buf-0.0004rad-2000ctl_cond-20000coupling_cond-2000ps-100ps-6ctl-6coupling-3_1_3_1_winding-2e10-drive-': ParameterizedMeas({ + (-1.000, -1.000,): [ + MeasRow(4e-09, [-18397, -19293, -18379, -18398, -19295, -18381]), + MeasRow(6e-09, [-30317, -8690, -30319, -30316, -8723, -30322]), + ], + (-1.000, 1.000,): [ + MeasRow(4e-09, [-18478, -18914, -18460, 17169, -16991, 17156]), + MeasRow(6e-09, [-30307, -15349, -30309, -30285, 16880, -30293]), + ], + ( 0.000, 0.000,): [ + MeasRow(4e-09, [ 10099, -17818, 10888, 10064, -17817, 10988]), + MeasRow(6e-09, [-30283, 10670, -30293, -30285, 10682, -30292]), + ], + ( 0.020, -0.020,): [ + MeasRow(4e-09, [ 11376, -17817, 12055, 4653, -17806, 4779]), + MeasRow(6e-09, [-30284, 13036, -30295, -30289, 5367, -30293]), + ], + ( 0.050, -0.050,): [ + MeasRow(4e-09, [ 13302, -17807, 13531, -12323, -17779, -12152]), + MeasRow(6e-09, [-30287, 16543, -30296, -30294, -9770, -30300]), + ], + ( 0.070, -0.070,): [ + MeasRow(4e-09, [ 16004, -17598, 16014, -17452, -18340, -17430]), + MeasRow(6e-09, [-30287, 16825, -30295, -30307, -14598, -30310]), + ], + ( 0.100, -0.100,): [ + MeasRow(4e-09, [ 16527, -17500, 16518, -17909, -18480, -17905]), + MeasRow(6e-09, [-30286, 16848, -30294, -30307, -14944, -30308]), + ], + ( 0.120, -0.120,): [ + MeasRow(4e-09, [ 16593, -17461, 16585, -17962, -18509, -17955]), + MeasRow(6e-09, [-30286, 16852, -30293, -30308, -14988, -30309]), + ], + ( 0.150, -0.150,): [ + MeasRow(4e-09, [ 16664, -17411, 16657, -18022, -18543, -18012]), + MeasRow(6e-09, [-30286, 16855, -30293, -30307, -15035, -30310]), + ], + ( 0.170, -0.170,): [ + MeasRow(4e-09, [ 16699, -17382, 16693, -18053, -18562, -18042]), + MeasRow(6e-09, [-30285, 16857, -30292, -30307, -15059, -30309]), + ], + ( 0.200, -0.200,): [ + MeasRow(4e-09, [ 16744, -17347, 16739, -18092, -18586, -18079]), + MeasRow(6e-09, [-30285, 16860, -30292, -30308, -15088, -30310]), + ], + ( 0.220, -0.220,): [ + MeasRow(4e-09, [ 16771, -17325, 16765, -18115, -18601, -18100]), + MeasRow(6e-09, [-30285, 16861, -30292, -30308, -15105, -30310]), + ], + ( 0.250, -0.250,): [ + MeasRow(4e-09, [ 16805, -17298, 16799, -18143, -18622, -18128]), + MeasRow(6e-09, [-30285, 16864, -30292, -30308, -15128, -30310]), + ], + ( 1.000, -1.000,): [ + MeasRow(4e-09, [ 17168, -16991, 17155, -18480, -18912, -18458]), + MeasRow(6e-09, [-30285, 16880, -30291, -30309, -15380, -30311]), + ], + }), + '57-buf-0.0004rad-2000ctl_cond-20000coupling_cond-2000ps-100ps-6ctl-6coupling-3_1_3_1_winding-5e9-drive-': ParameterizedMeas({ + (-1.000, -1.000,): [ + MeasRow(4e-09, [-17996, -18705, -17983, -17996, -18706, -17984]), + MeasRow(6e-09, [-28770, -10948, -28765, -28765, -10962, -28772]), + ], + (-1.000, 1.000,): [ + MeasRow(4e-09, [-18035, -18363, -18025, 17000, -16933, 16995]), + MeasRow(6e-09, [-28777, -13298, -28778, -28759, 15640, -28766]), + ], + ( 0.000, 0.000,): [ + MeasRow(4e-09, [ 5860, -17466, 6174, 5876, -17466, 6257]), + MeasRow(6e-09, [-28765, 4202, -28761, -28761, 4260, -28768]), + ], + ( 0.020, -0.020,): [ + MeasRow(4e-09, [ 6578, -17469, 6866, 5183, -17464, 5559]), + MeasRow(6e-09, [-28765, 4902, -28760, -28760, 3605, -28768]), + ], + ( 0.050, -0.050,): [ + MeasRow(4e-09, [ 7645, -17472, 7877, 4085, -17461, 4505]), + MeasRow(6e-09, [-28763, 5950, -28758, -28759, 2637, -28766]), + ], + ( 0.070, -0.070,): [ + MeasRow(4e-09, [ 8313, -17475, 8512, 3207, -17459, 3708]), + MeasRow(6e-09, [-28762, 6621, -28757, -28760, 1916, -28767]), + ], + ( 0.100, -0.100,): [ + MeasRow(4e-09, [ 9247, -17477, 9409, 1162, -17458, 1335]), + MeasRow(6e-09, [-28762, 7742, -28758, -28759, 176, -28767]), + ], + ( 0.120, -0.120,): [ + MeasRow(4e-09, [ 9829, -17478, 9977, -1279, -17453, -1174]), + MeasRow(6e-09, [-28763, 8666, -28759, -28759, -1645, -28767]), + ], + ( 0.150, -0.150,): [ + MeasRow(4e-09, [ 10692, -17478, 10803, -5374, -17445, -5301]), + MeasRow(6e-09, [-28765, 10062, -28762, -28759, -4543, -28766]), + ], + ( 0.170, -0.170,): [ + MeasRow(4e-09, [ 11310, -17478, 11375, -8190, -17441, -8123]), + MeasRow(6e-09, [-28766, 10963, -28763, -28762, -6493, -28770]), + ], + ( 0.200, -0.200,): [ + MeasRow(4e-09, [ 12465, -17476, 12553, -12387, -17439, -12329]), + MeasRow(6e-09, [-28766, 12448, -28763, -28763, -9375, -28767]), + ], + ( 0.220, -0.220,): [ + MeasRow(4e-09, [ 14253, -17444, 14317, -15013, -17451, -14971]), + MeasRow(6e-09, [-28763, 13992, -28758, -28771, -11134, -28773]), + ], + ( 0.250, -0.250,): [ + MeasRow(4e-09, [ 15607, -17368, 15637, -16727, -17821, -16710]), + MeasRow(6e-09, [-28762, 14985, -28758, -28778, -12376, -28778]), + ], + ( 1.000, -1.000,): [ + MeasRow(4e-09, [ 16999, -16931, 16996, -18037, -18363, -18023]), + MeasRow(6e-09, [-28763, 15632, -28759, -28780, -13374, -28777]), + ], + }), } \ No newline at end of file diff --git a/crates/applications/stacked_cores/src/main.rs b/crates/applications/stacked_cores/src/main.rs index 153f6d0..b4246e1 100644 --- a/crates/applications/stacked_cores/src/main.rs +++ b/crates/applications/stacked_cores/src/main.rs @@ -1414,6 +1414,22 @@ fn drive_map_buf_56(amp0: f32, amp1: f32) -> [[ClockState; 6]; 3] { ] } + +#[allow(unused)] +fn drive_map_buf_57(amp0: f32, amp1: f32) -> [[ClockState; 6]; 3] { + use ClockState as C; + // amplitudes are inverted from what you would expect. + // hold(-1) puts the core into a positive M + [ + // init S0/S2 pos, S3/S5 pos; charge S1/S4 neg + [C::hold(-amp0), C::hold_high(), C::hold(-amp0), C::hold(-amp1), C::hold_high(), C::hold(-amp1), ], + // let settle + [C::release(-amp0), C::release_high(), C::release(-amp0), C::release(-amp1), C::release_high(), C::release(-amp1),], + // clear S0/S2 -> S1, S3/S5 -> S4 + [C::hold_high(), C::float(), C::hold_high(), C::hold_high(), C::float(), C::hold_high(), ], + ] +} + fn asymmetric_inverter_name(p: &Params, sim_id: &str, windings: u32, init_flt: f32) -> String { let init_int = (init_flt.abs() * 100.0 + 0.5) as u32; let init_level = if init_flt > 0.0 { @@ -6237,7 +6253,7 @@ fn main() { } } - if true { + if false { for init_set in [ // M2, M3 are treated as X and -X, respectively. // because it's differential, testing (-1, 1) is sort of extraneous with (1, -1). @@ -6346,6 +6362,157 @@ fn main() { } } } + + if true { + for init_set in [ + &[ + // establish rough domain/range + ( 1.00, -1.00), + (-1.00, 1.00), // technically extraneous + ][..], + &[ + ( 0.00, 0.00), + ( 0.20, -0.20), + ( 0.10, -0.10), + (-1.00, -1.00), // uninitialized case + ][..], + &[ + // negative side + // (-0.10, 0.10), + // (-0.20, 0.20), + // (-0.25, 0.25), + // (-0.05, 0.05), + // (-0.15, 0.15), + ][..], + &[ + // more detailed sweep + ( 0.05, -0.05), + ( 0.15, -0.15), + ( 0.25, -0.25), + ][..], + &[ + // even more verbosity + // (-0.02, 0.02), + // (-0.07, 0.07), + // (-0.12, 0.12), + // (-0.17, 0.17), + // (-0.22, 0.22), + + ( 0.02, -0.02), + ( 0.07, -0.07), + ( 0.12, -0.12), + ( 0.17, -0.17), + ( 0.22, -0.22), + ][..], + &[ + ( 0.30, -0.30), + ( 0.50, -0.50), + ( 0.01, -0.01), + ( 0.03, -0.03), + ( 0.04, -0.04), + ( 0.06, -0.06), + ( 0.08, -0.08), + ( 0.13, -0.13), + ( 0.18, -0.18), + ( 0.23, -0.23), + ][..], + ] { + for (ctl_cond, coupling_cond, clock_duration, clock_decay, coupling_loops, pos_inp_loops, neg_inp_loops, s_major, cur_flt) in [ + // total slot use is L*(6*A + 1), + // where L is the "coupling loops" and A is the inp_loops ("asymmetric loops") + // e.g. L=6, A=1 gives 42 + // e.g. L=3, A=2 gives 39 + // e.g. L=2, A=3 gives 38 + // special case of A=0 is L*(3 + 1) + // L=10, A=0 gives 40 + + // Y(-18000, 17000) = (-13300, 15600) + // Y( 17000, -18000) = ( 15600, -13400) + // slope: 0.83 + (2e3, 2e4, ps(2000), ps(100), 6, 1, 1, um(400), 5e9), + // Y(-17700, 16900) = (-14600, 3000) + // Y( 16900, -17700) = ( 3000, -14600) + // slope: 0.51 + // too low tx + // (2e3, 2e4, ps(2000), ps(100), 6, 1, 1, um(400), 2e9), + // Y(-18500, 17200) = (-15300, 16900) + // Y( 17200, -18500) = ( 16900, -15400) + // slope: 0.94 + (2e3, 2e4, ps(2000), ps(100), 6, 1, 1, um(400), 2e10), + // Y(-17500, 17000) = (-15200, 16400) + // Y( 17000, -17600) = ( 16400, -15100) + // slope: 0.95 + (2e3, 2e4, ps(2000), ps(100), 3, 2, 2, um(400), 5e10), + ] { + for &(init_flt_a, init_flt_b) in init_set { + // layout: + // M0 -> M1 <- M2 M3 -> M4 <- M5 + // \______________/ + // {M0,M2} -> M1 is asymmetric (input writing to output) + // {M3,M5} -> M4 is asymmetric (input writing to output) + // M1 <-> M4 is symmetric (output coupling) + let slots_per_asym_pos = (2*pos_inp_loops).max(1); + let slots_per_asym_neg = (2*neg_inp_loops).max(1); + let slots_per_asym = slots_per_asym_pos.max(slots_per_asym_neg); + let net_slots = 3*slots_per_asym + 1; + let mut params = params_v2 + .with_clock_phase_duration(clock_duration) + .with_clock_decay(clock_decay) + .with_ctl_conductivity(ctl_cond) + .with_coupling_conductivity(coupling_cond) + .with_s_major(s_major) + .with_coupling_loops(coupling_loops) + .with_input_magnitude(cur_flt) + // control loops + .with_coupling(0, 0, 0, net_slots, CouplingMethod::Control) + .with_coupling(1, 1, 0, net_slots, CouplingMethod::Control) + .with_coupling(2, 2, 0, net_slots, CouplingMethod::Control) + .with_coupling(3, 3, 0, net_slots, CouplingMethod::Control) + .with_coupling(4, 4, 0, net_slots, CouplingMethod::Control) + .with_coupling(5, 5, 0, net_slots, CouplingMethod::Control) + ; + for i in 0..slots_per_asym { + // couple output core 1 to core 4 + params = params.with_coupling(1, 4, 1+i, net_slots, CouplingMethod::Outside); + } + if pos_inp_loops != 0 { + // couple input M0 -> output M1 + params = couple_asymmetric_buffer_bi(¶ms, 0 /* low core */, pos_inp_loops /* M0 loops */, 0 /* M1 loops */, 1 + slots_per_asym /* slot offset */, net_slots); + // couple input M2 -> output M1 + params = couple_asymmetric_buffer_bi(¶ms, 1 /* low core */, 0 /* M1 loops */, pos_inp_loops /* M2 loops */, 1 + 2*slots_per_asym /* slot offset */, net_slots); + } else { + // directly couple M0 -> M1, M2 -> M1 + for i in 0..slots_per_asym { + params = params.with_coupling(0, 1, 1 + slots_per_asym + i, net_slots, CouplingMethod::Direct); + params = params.with_coupling(2, 1, 1 + 2*slots_per_asym + i, net_slots, CouplingMethod::Direct); + } + } + + if neg_inp_loops != 0 { + // couple input M3 -> output M4 + params = couple_asymmetric_buffer_bi(¶ms, 3 /* low core */, neg_inp_loops /* M3 loops */, 0 /* M4 loops */, 1 + slots_per_asym /* slot offset */, net_slots); + // couple input M5 -> output M4 + params = couple_asymmetric_buffer_bi(¶ms, 4 /* low core */, 0 /* M4 loops */, neg_inp_loops /* M5 loops */, 1 + 2*slots_per_asym /* slot offset */, net_slots); + } else { + // directly couple M3 -> M4, M5 -> M4 + for i in 0..slots_per_asym { + params = params.with_coupling(3, 4, 1 + slots_per_asym + i, net_slots, CouplingMethod::Direct); + params = params.with_coupling(5, 4, 1 + 2*slots_per_asym + i, net_slots, CouplingMethod::Direct); + } + } + + let name = asymmetric_binary_gate_name_v2( + ¶ms, "57-buf", coupling_loops /* ctl loops */, coupling_loops, 2*pos_inp_loops + 1, 2*neg_inp_loops + 1, init_flt_a, init_flt_b + ); + run_sim( + &name, + drive_map_buf_57(init_flt_a, init_flt_b), + params, + ); + } + } + } + } }