From 1f3fca29c0f11d5382703ed9fe49431d2e812d14 Mon Sep 17 00:00:00 2001 From: Wanda Date: Fri, 22 Nov 2024 02:42:15 +0000 Subject: [PATCH] xact_dump: reach pinouts by violence. --- prjcombine_xact_dump/src/main.rs | 48 ++- prjcombine_xact_dump/src/xc2000.rs | 178 +++++++++- prjcombine_xact_dump/src/xc4000.rs | 536 ++++++++++++++++++++++++++++- prjcombine_xact_dump/src/xc5200.rs | 492 +++++++++++++++++++++++++- prjcombine_xc2000/src/bond.rs | 2 + prjcombine_xc2000/src/grid.rs | 20 +- 6 files changed, 1257 insertions(+), 19 deletions(-) diff --git a/prjcombine_xact_dump/src/main.rs b/prjcombine_xact_dump/src/main.rs index 7a562125..7490bed6 100644 --- a/prjcombine_xact_dump/src/main.rs +++ b/prjcombine_xact_dump/src/main.rs @@ -109,7 +109,29 @@ fn main() { let ExpandedNamedDevice::Xc2000(ref endev) = endev else { unreachable!() }; - let bond = xc2000::make_bond(endev, &pkg); + let (bond, cfg_io) = xc2000::make_bond(endev, &part.package, &pkg); + let pin_xtl1 = &part.kv["OSCIOB1"][0]; + let pin_xtl2 = &part.kv["OSCIOB2"][0]; + let io_xtl1 = bond.pins[pin_xtl1]; + let io_xtl2 = bond.pins[pin_xtl2]; + assert_eq!( + io_xtl1, + prjcombine_xc2000::bond::BondPin::Io(endev.grid.io_xtl1()) + ); + assert_eq!( + io_xtl2, + prjcombine_xc2000::bond::BondPin::Io(endev.grid.io_xtl2()) + ); + if !cfg_io.is_empty() { + let Grid::Xc2000(ref mut grid) = db.grids[grid] else { + unreachable!() + }; + if grid.cfg_io.is_empty() { + grid.cfg_io = cfg_io; + } else { + assert_eq!(grid.cfg_io, cfg_io); + } + } Bond::Xc2000(bond) } PartKind::Xc3000 => todo!(), @@ -117,14 +139,34 @@ fn main() { let ExpandedNamedDevice::Xc4000(ref endev) = endev else { unreachable!() }; - let bond = xc4000::make_bond(endev, &pkg); + let (bond, cfg_io) = xc4000::make_bond(endev, &part.package, &pkg); + if !cfg_io.is_empty() { + let Grid::Xc4000(ref mut grid) = db.grids[grid] else { + unreachable!() + }; + if grid.cfg_io.is_empty() { + grid.cfg_io = cfg_io; + } else { + assert_eq!(grid.cfg_io, cfg_io); + } + } Bond::Xc4000(bond) } PartKind::Xc5200 => { let ExpandedNamedDevice::Xc5200(ref endev) = endev else { unreachable!() }; - let bond = xc5200::make_bond(endev, &pkg); + let (bond, cfg_io) = xc5200::make_bond(endev, &part.package, &pkg); + if !cfg_io.is_empty() { + let Grid::Xc5200(ref mut grid) = db.grids[grid] else { + unreachable!() + }; + if grid.cfg_io.is_empty() { + grid.cfg_io = cfg_io; + } else { + assert_eq!(grid.cfg_io, cfg_io); + } + } Bond::Xc5200(bond) } PartKind::Xc7000 => unreachable!(), diff --git a/prjcombine_xact_dump/src/xc2000.rs b/prjcombine_xact_dump/src/xc2000.rs index c61584fc..82952dc7 100644 --- a/prjcombine_xact_dump/src/xc2000.rs +++ b/prjcombine_xact_dump/src/xc2000.rs @@ -8,8 +8,8 @@ use prjcombine_int::{ use prjcombine_xact_data::die::Die; use prjcombine_xact_naming::db::{NamingDb, NodeNaming}; use prjcombine_xc2000::{ - bond::{Bond, BondPin}, - grid::Grid, + bond::{Bond, BondPin, CfgPin}, + grid::{Grid, IoCoord, SharedCfgPin}, }; use prjcombine_xc2000_xact::{name_device, ExpandedNamedDevice}; use unnamed_entity::{EntityId, EntityVec}; @@ -588,7 +588,11 @@ pub fn dump_grid(die: &Die) -> (Grid, IntDb, NamingDb) { (grid, intdb, ndb) } -pub fn make_bond(endev: &ExpandedNamedDevice, pkg: &BTreeMap) -> Bond { +pub fn make_bond( + endev: &ExpandedNamedDevice, + name: &str, + pkg: &BTreeMap, +) -> (Bond, BTreeMap) { let io_lookup: BTreeMap<_, _> = endev .edev .get_bonded_ios() @@ -600,7 +604,171 @@ pub fn make_bond(endev: &ExpandedNamedDevice, pkg: &BTreeMap) -> }; for (pin, pad) in pkg { let io = io_lookup[&**pad]; - bond.pins.insert(pin.into(), BondPin::Io(io)); + bond.pins.insert(pin.to_ascii_uppercase(), BondPin::Io(io)); } - bond + let (pwrdwn, m1, m0, prog, done, cclk, gnd, vcc) = match name { + "pd48" => ( + "P7", + "P17", + "P18", + "P31", + "P32", + "P42", + &["P24"][..], + &["P12"][..], + ), + "pc44" => ( + "P8", + "P16", + "P17", + "P27", + "P28", + "P38", + &["P1", "P23"][..], + &["P12", "P33"][..], + ), + "pc68" => ( + "P10", + "P25", + "P26", + "P44", + "P45", + "P60", + &["P1", "P35"][..], + &["P18", "P52"][..], + ), + "pc84" => ( + "P12", + "P31", + "P32", + "P54", + "P55", + "P74", + &["P1", "P43"][..], + &["P22", "P64"][..], + ), + "vq64" => ( + "P17", + "P31", + "P32", + "P48", + "P49", + "P64", + &["P8", "P41"][..], + &["P24", "P56"][..], + ), + "tq100" | "vq100" => ( + "P26", + "P49", + "P51", + "P75", + "P77", + "P99", + &["P13", "P63"][..], + &["P38", "P88"][..], + ), + "pg68" => ( + "B2", + "J1", + "K1", + "K10", + "K11", + "B11", + &["B6", "K6"][..], + &["F2", "F10"][..], + ), + "pg84" => ( + "B2", + "J2", + "L1", + "K10", + "J10", + "A11", + &["C6", "J6"][..], + &["F3", "F9"][..], + ), + _ => panic!("ummm {name}?"), + }; + assert_eq!( + bond.pins + .insert(pwrdwn.into(), BondPin::Cfg(CfgPin::PwrdwnB)), + None + ); + assert_eq!(bond.pins.insert(m0.into(), BondPin::Cfg(CfgPin::M0)), None); + assert_eq!(bond.pins.insert(m1.into(), BondPin::Cfg(CfgPin::M1)), None); + assert_eq!( + bond.pins.insert(prog.into(), BondPin::Cfg(CfgPin::ProgB)), + None + ); + assert_eq!( + bond.pins.insert(done.into(), BondPin::Cfg(CfgPin::Done)), + None + ); + assert_eq!( + bond.pins.insert(cclk.into(), BondPin::Cfg(CfgPin::Cclk)), + None + ); + for &pin in gnd { + assert_eq!(bond.pins.insert(pin.into(), BondPin::Gnd), None); + } + for &pin in vcc { + assert_eq!(bond.pins.insert(pin.into(), BondPin::Vcc), None); + } + match name { + "pd48" => assert_eq!(bond.pins.len(), 48), + "pc44" => assert_eq!(bond.pins.len(), 44), + "pc68" => assert_eq!(bond.pins.len(), 68), + "pc84" => assert_eq!(bond.pins.len(), 84), + "vq64" => assert_eq!(bond.pins.len(), 64), + "vq100" | "tq100" => { + for i in 1..=100 { + bond.pins.entry(format!("P{i}")).or_insert(BondPin::Nc); + } + } + "pg68" => assert_eq!(bond.pins.len(), 68), + "pg84" => assert_eq!(bond.pins.len(), 84), + _ => panic!("ummm {name}?"), + }; + + let mut cfg_io = BTreeMap::new(); + if name == "pc68" { + for (pin, fun) in [ + ("P2", SharedCfgPin::Addr(13)), + ("P3", SharedCfgPin::Addr(6)), + ("P4", SharedCfgPin::Addr(12)), + ("P5", SharedCfgPin::Addr(7)), + ("P6", SharedCfgPin::Addr(11)), + ("P7", SharedCfgPin::Addr(8)), + ("P8", SharedCfgPin::Addr(10)), + ("P9", SharedCfgPin::Addr(9)), + ("P27", SharedCfgPin::M2), + ("P28", SharedCfgPin::Hdc), + ("P30", SharedCfgPin::Ldc), + ("P41", SharedCfgPin::Data(7)), + ("P42", SharedCfgPin::Data(6)), + ("P48", SharedCfgPin::Data(5)), + ("P50", SharedCfgPin::Data(4)), + ("P51", SharedCfgPin::Data(3)), + ("P54", SharedCfgPin::Data(2)), + ("P56", SharedCfgPin::Data(1)), + ("P57", SharedCfgPin::RclkB), + ("P58", SharedCfgPin::Data(0)), + ("P59", SharedCfgPin::Dout), + ("P61", SharedCfgPin::Addr(0)), + ("P62", SharedCfgPin::Addr(1)), + ("P63", SharedCfgPin::Addr(2)), + ("P64", SharedCfgPin::Addr(3)), + ("P65", SharedCfgPin::Addr(15)), + ("P66", SharedCfgPin::Addr(4)), + ("P67", SharedCfgPin::Addr(14)), + ("P68", SharedCfgPin::Addr(5)), + ] { + let BondPin::Io(io) = bond.pins[pin] else { + unreachable!() + }; + cfg_io.insert(fun, io); + } + } + + (bond, cfg_io) } diff --git a/prjcombine_xact_dump/src/xc4000.rs b/prjcombine_xact_dump/src/xc4000.rs index 60432b47..4516539a 100644 --- a/prjcombine_xact_dump/src/xc4000.rs +++ b/prjcombine_xact_dump/src/xc4000.rs @@ -11,8 +11,8 @@ use prjcombine_int::{ use prjcombine_xact_data::die::Die; use prjcombine_xact_naming::db::{NamingDb, NodeNaming}; use prjcombine_xc4000::{ - bond::{Bond, BondPin}, - grid::{Grid, GridKind}, + bond::{Bond, BondPin, CfgPin}, + grid::{Grid, GridKind, IoCoord, SharedCfgPin}, }; use prjcombine_xc4000_xact::{name_device, ExpandedNamedDevice}; use unnamed_entity::{EntityId, EntityVec}; @@ -1749,7 +1749,11 @@ pub fn dump_grid(die: &Die) -> (Grid, IntDb, NamingDb) { (grid, intdb, ndb) } -pub fn make_bond(endev: &ExpandedNamedDevice, pkg: &BTreeMap) -> Bond { +pub fn make_bond( + endev: &ExpandedNamedDevice, + name: &str, + pkg: &BTreeMap, +) -> (Bond, BTreeMap) { let io_lookup: BTreeMap<_, _> = endev .edev .get_bonded_ios() @@ -1763,5 +1767,529 @@ pub fn make_bond(endev: &ExpandedNamedDevice, pkg: &BTreeMap) -> let io = io_lookup[&**pad]; bond.pins.insert(pin.into(), BondPin::Io(io)); } - bond + let (m1, m0, m2, done, prog, cclk, tdo, gnd, vcc) = match name { + "pc84" => ( + "P30", + "P32", + "P34", + "P53", + "P55", + "P73", + "P75", + &["P1", "P12", "P21", "P31", "P43", "P52", "P64", "P76"][..], + &["P2", "P11", "P22", "P33", "P42", "P54", "P63", "P74"][..], + ), + + "vq100" => ( + "P22", + "P24", + "P26", + "P50", + "P52", + "P74", + "P76", + &["P1", "P11", "P23", "P38", "P49", "P64", "P77", "P88"][..], + &["P12", "P25", "P37", "P51", "P63", "P75", "P89", "P100"][..], + ), + "tq144" => ( + "P34", + "P36", + "P38", + "P72", + "P74", + "P107", + "P109", + &[ + "P1", "P8", "P17", "P27", "P35", "P45", "P55", "P64", "P71", "P73", "P81", "P91", + "P100", "P110", "P118", "P127", "P137", + ][..], + &["P18", "P37", "P54", "P90", "P108", "P128", "P144"][..], + ), + + "pq100" => ( + "P25", + "P27", + "P29", + "P53", + "P55", + "P77", + "P79", + &["P4", "P14", "P26", "P41", "P52", "P67", "P80", "P91"][..], + &["P3", "P15", "P28", "P40", "P54", "P66", "P78", "P92"][..], + ), + "pq160" => ( + "P38", + "P40", + "P42", + "P80", + "P82", + "P119", + "P121", + &[ + "P1", "P10", "P19", "P29", "P39", "P51", "P61", "P70", "P79", "P91", "P101", + "P110", "P122", "P131", "P141", "P151", + ][..], + &["P20", "P41", "P60", "P81", "P100", "P120", "P142", "P160"][..], + ), + "pq208" | "mq208" => ( + "P48", + "P50", + "P56", + "P103", + "P108", + "P153", + "P159", + &[ + "P2", "P14", "P25", "P37", "P49", "P67", "P79", "P90", "P101", "P119", "P131", + "P142", "P160", "P171", "P182", "P194", + ][..], + &["P26", "P55", "P78", "P106", "P130", "P154", "P183", "P205"][..], + ), + "pq240" | "mq240" => ( + "P58", + "P60", + "P62", + "P120", + "P122", + "P179", + "P181", + &[ + "P1", "P14", "P29", "P45", "P59", "P75", "P91", "P106", "P119", "P135", "P151", + "P166", "P182", "P196", "P211", "P227", + ][..], + &[ + "P19", "P30", "P40", "P61", "P80", "P90", "P101", "P121", "P140", "P150", "P161", + "P180", "P201", "P212", "P222", "P240", + ][..], + ), + + "cb100" => ( + "P22", + "P24", + "P26", + "P50", + "P52", + "P74", + "P76", + &["P1", "P11", "P23", "P38", "P49", "P64", "P77", "P88"][..], + &["P12", "P25", "P37", "P51", "P63", "P75", "P89", "P100"][..], + ), + "cb164" => ( + "P39", + "P41", + "P43", + "P82", + "P84", + "P122", + "P124", + &[ + "P1", "P10", "P19", "P30", "P40", "P53", "P63", "P72", "P81", "P94", "P104", + "P113", "P125", "P135", "P144", "P154", + ][..], + &["P20", "P42", "P62", "P83", "P103", "P123", "P145", "P164"][..], + ), + "cb196" => ( + "P47", + "P49", + "P51", + "P98", + "P100", + "P146", + "P148", + &[ + "P1", "P13", "P24", "P36", "P48", "P63", "P75", "P86", "P97", "P112", "P124", + "P135", "P149", "P161", "P172", "P184", + ][..], + &["P25", "P50", "P74", "P99", "P123", "P147", "P173", "P196"][..], + ), + "cb228" => ( + "P55", + "P57", + "P59", + "P114", + "P116", + "P170", + "P172", + &[ + "P1", "P14", "P27", "P42", "P56", "P72", "P86", "P100", "P113", "P129", "P143", + "P157", "P173", "P186", "P200", "P215", + ][..], + &[ + "P28", "P37", "P58", "P85", "P95", "P115", "P142", "P152", "P171", "P191", "P201", + "P210", "P228", + ][..], + ), + + "pg120" => ( + "B11", + "C11", + "B12", + "L11", + "M12", + "L4", + "M2", + &["C4", "B7", "C10", "G11", "K11", "L7", "K3", "G2"][..], + &["G3", "C3", "C7", "D11", "G12", "L10", "M7", "L3"][..], + ), + "pg156" => ( + "A15", + "A16", + "B15", + "R15", + "R14", + "R2", + "T1", + &[ + "F3", "C4", "C6", "C8", "C11", "C13", "F14", "J14", "L14", "P14", "P11", "P8", + "P6", "N3", "L3", "H2", + ][..], + &["H3", "C3", "B8", "C14", "H14", "P13", "R8", "P3"][..], + ), + "pg191" => ( + "C15", + "A18", + "C16", + "U17", + "V18", + "V1", + "U2", + &[ + "G3", "D4", "C7", "D9", "C12", "D15", "G16", "K15", "M16", "R16", "T12", "R9", + "T7", "R3", "M3", "K4", + ][..], + &["J4", "D3", "D10", "D16", "J15", "R15", "R10", "R4"][..], + ), + "pg223" => ( + "C15", + "A18", + "C16", + "U17", + "V18", + "V1", + "U2", + &[ + "G3", "D4", "C7", "D9", "C12", "D15", "G16", "K15", "M16", "R16", "T12", "R9", + "T7", "R3", "M3", "K4", + ][..], + &["J4", "D3", "D10", "D16", "J15", "R15", "R10", "R4"][..], + ), + + "bg225" => ( + "N3", + "P2", + "M4", + "P14", + "M12", + "C13", + "A15", + &[ + "A1", "D12", "G7", "G9", "H6", "H8", "H10", "J8", "K8", "A8", "F8", "G8", "H2", + "H7", "H9", "J7", "J9", "M8", + ][..], + &["B2", "D8", "H15", "R8", "B14", "R1", "H1", "R15"][..], + ), + + _ => panic!("ummm {name}?"), + }; + assert_eq!(bond.pins.insert(m0.into(), BondPin::Cfg(CfgPin::M0)), None); + assert_eq!(bond.pins.insert(m1.into(), BondPin::Cfg(CfgPin::M1)), None); + assert_eq!(bond.pins.insert(m2.into(), BondPin::Cfg(CfgPin::M2)), None); + assert_eq!( + bond.pins.insert(prog.into(), BondPin::Cfg(CfgPin::ProgB)), + None + ); + assert_eq!( + bond.pins.insert(done.into(), BondPin::Cfg(CfgPin::Done)), + None + ); + assert_eq!( + bond.pins.insert(cclk.into(), BondPin::Cfg(CfgPin::Cclk)), + None + ); + assert_eq!( + bond.pins.insert(tdo.into(), BondPin::Cfg(CfgPin::Tdo)), + None + ); + for &pin in gnd { + assert_eq!(bond.pins.insert(pin.into(), BondPin::Gnd), None); + } + for &pin in vcc { + assert_eq!(bond.pins.insert(pin.into(), BondPin::VccO), None); + } + + let len1d = match name { + "pc84" => Some(84), + "vq100" => Some(100), + "tq144" => Some(144), + "pq100" => Some(100), + "pq160" => Some(160), + "pq208" | "mq208" => Some(208), + "pq240" | "mq240" => Some(240), + "cb100" => Some(100), + "cb164" => Some(164), + "cb196" => Some(196), + "cb228" => Some(228), + _ => None, + }; + if let Some(len1d) = len1d { + for i in 1..=len1d { + bond.pins.entry(format!("P{i}")).or_insert(BondPin::Nc); + } + assert_eq!(bond.pins.len(), len1d); + } + match name { + "bg225" => { + for a in [ + "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", + ] { + for i in 1..=15 { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + assert_eq!(bond.pins.len(), 225); + } + "pg120" => { + for a in ["A", "B", "C", "L", "M", "N"] { + for i in 1..=13 { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + for a in ["D", "E", "F", "G", "H", "J", "K"] { + for i in (1..=3).chain(11..=13) { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + assert_eq!(bond.pins.len(), 120); + } + "pg156" => { + for a in ["A", "B", "C", "P", "R", "T"] { + for i in 1..=16 { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + for a in ["D", "E", "F", "G", "H", "J", "K", "L", "M", "N"] { + for i in (1..=3).chain(14..=16) { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + assert_eq!(bond.pins.len(), 156); + } + "pg191" => { + for i in 2..=18 { + bond.pins.entry(format!("A{i}")).or_insert(BondPin::Nc); + } + for a in ["B", "C", "T", "U", "V"] { + for i in 1..=18 { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + for a in ["D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R"] { + for i in (1..=3).chain(16..=18) { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + for a in ["D", "R"] { + for i in [4, 9, 10, 15] { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + for a in ["J", "K"] { + for i in [4, 15] { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + assert_eq!(bond.pins.len(), 191); + } + "pg223" => { + for i in 2..=18 { + bond.pins.entry(format!("A{i}")).or_insert(BondPin::Nc); + } + for a in ["B", "C", "D", "R", "T", "U", "V"] { + for i in 1..=18 { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + for a in ["E", "F", "G", "H", "J", "K", "L", "M", "N", "P"] { + for i in (1..=4).chain(15..=18) { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + assert_eq!(bond.pins.len(), 223); + } + _ => (), + } + + let mut pkg_cfg_io = vec![]; + match name { + "pc84" => { + pkg_cfg_io.extend([ + ("P3", SharedCfgPin::Addr(8)), + ("P4", SharedCfgPin::Addr(9)), + ("P5", SharedCfgPin::Addr(10)), + ("P6", SharedCfgPin::Addr(11)), + ("P7", SharedCfgPin::Addr(12)), + ("P8", SharedCfgPin::Addr(13)), + ("P9", SharedCfgPin::Addr(14)), + ("P10", SharedCfgPin::Addr(15)), + ("P13", SharedCfgPin::Addr(16)), + ("P14", SharedCfgPin::Addr(17)), + ("P15", SharedCfgPin::Tdi), + ("P16", SharedCfgPin::Tck), + ("P17", SharedCfgPin::Tms), + ("P36", SharedCfgPin::Hdc), + ("P37", SharedCfgPin::Ldc), + ("P41", SharedCfgPin::InitB), + ("P56", SharedCfgPin::Data(7)), + ("P58", SharedCfgPin::Data(6)), + ("P59", SharedCfgPin::Data(5)), + ("P60", SharedCfgPin::Cs0B), + ("P61", SharedCfgPin::Data(4)), + ("P65", SharedCfgPin::Data(3)), + ("P66", SharedCfgPin::RsB), + ("P67", SharedCfgPin::Data(2)), + ("P69", SharedCfgPin::Data(1)), + ("P70", SharedCfgPin::BusyB), + ("P71", SharedCfgPin::Data(0)), + ("P72", SharedCfgPin::Dout), + ("P77", SharedCfgPin::Addr(0)), + ("P78", SharedCfgPin::Addr(1)), + ("P79", SharedCfgPin::Addr(2)), + ("P80", SharedCfgPin::Addr(3)), + ("P81", SharedCfgPin::Addr(4)), + ("P82", SharedCfgPin::Addr(5)), + ("P83", SharedCfgPin::Addr(6)), + ("P84", SharedCfgPin::Addr(7)), + ]); + } + "pq160" | "mq160" => { + pkg_cfg_io.extend([ + ("P143", SharedCfgPin::Addr(8)), + ("P144", SharedCfgPin::Addr(9)), + ("P147", SharedCfgPin::Addr(10)), + ("P148", SharedCfgPin::Addr(11)), + ("P154", SharedCfgPin::Addr(12)), + ("P155", SharedCfgPin::Addr(13)), + ("P158", SharedCfgPin::Addr(14)), + ("P159", SharedCfgPin::Addr(15)), + ("P2", SharedCfgPin::Addr(16)), + ("P3", SharedCfgPin::Addr(17)), + ("P6", SharedCfgPin::Tdi), + ("P7", SharedCfgPin::Tck), + ("P13", SharedCfgPin::Tms), + ("P44", SharedCfgPin::Hdc), + ("P48", SharedCfgPin::Ldc), + ("P59", SharedCfgPin::InitB), + ("P83", SharedCfgPin::Data(7)), + ("P87", SharedCfgPin::Data(6)), + ("P94", SharedCfgPin::Data(5)), + ("P95", SharedCfgPin::Cs0B), + ("P98", SharedCfgPin::Data(4)), + ("P102", SharedCfgPin::Data(3)), + ("P103", SharedCfgPin::RsB), + ("P106", SharedCfgPin::Data(2)), + ("P113", SharedCfgPin::Data(1)), + ("P114", SharedCfgPin::BusyB), + ("P117", SharedCfgPin::Data(0)), + ("P118", SharedCfgPin::Dout), + ("P123", SharedCfgPin::Addr(0)), + ("P124", SharedCfgPin::Addr(1)), + ("P127", SharedCfgPin::Addr(2)), + ("P128", SharedCfgPin::Addr(3)), + ("P134", SharedCfgPin::Addr(4)), + ("P135", SharedCfgPin::Addr(5)), + ("P139", SharedCfgPin::Addr(6)), + ("P140", SharedCfgPin::Addr(7)), + ]); + } + "pq208" | "mq208" => { + pkg_cfg_io.extend([ + ("P184", SharedCfgPin::Addr(8)), + ("P185", SharedCfgPin::Addr(9)), + ("P190", SharedCfgPin::Addr(10)), + ("P191", SharedCfgPin::Addr(11)), + ("P199", SharedCfgPin::Addr(12)), + ("P200", SharedCfgPin::Addr(13)), + ("P203", SharedCfgPin::Addr(14)), + ("P204", SharedCfgPin::Addr(15)), + ("P4", SharedCfgPin::Addr(16)), + ("P5", SharedCfgPin::Addr(17)), + ("P8", SharedCfgPin::Tdi), + ("P9", SharedCfgPin::Tck), + ("P17", SharedCfgPin::Tms), + ("P58", SharedCfgPin::Hdc), + ("P62", SharedCfgPin::Ldc), + ("P77", SharedCfgPin::InitB), + ("P109", SharedCfgPin::Data(7)), + ("P113", SharedCfgPin::Data(6)), + ("P122", SharedCfgPin::Data(5)), + ("P123", SharedCfgPin::Cs0B), + ("P128", SharedCfgPin::Data(4)), + ("P132", SharedCfgPin::Data(3)), + ("P133", SharedCfgPin::RsB), + ("P138", SharedCfgPin::Data(2)), + ("P147", SharedCfgPin::Data(1)), + ("P148", SharedCfgPin::BusyB), + ("P151", SharedCfgPin::Data(0)), + ("P152", SharedCfgPin::Dout), + ("P161", SharedCfgPin::Addr(0)), + ("P162", SharedCfgPin::Addr(1)), + ("P165", SharedCfgPin::Addr(2)), + ("P166", SharedCfgPin::Addr(3)), + ("P174", SharedCfgPin::Addr(4)), + ("P175", SharedCfgPin::Addr(5)), + ("P180", SharedCfgPin::Addr(6)), + ("P181", SharedCfgPin::Addr(7)), + ]); + } + "pq240" | "mq240" => { + pkg_cfg_io.extend([ + ("P213", SharedCfgPin::Addr(8)), + ("P214", SharedCfgPin::Addr(9)), + ("P220", SharedCfgPin::Addr(10)), + ("P221", SharedCfgPin::Addr(11)), + ("P232", SharedCfgPin::Addr(12)), + ("P233", SharedCfgPin::Addr(13)), + ("P238", SharedCfgPin::Addr(14)), + ("P239", SharedCfgPin::Addr(15)), + ("P2", SharedCfgPin::Addr(16)), + ("P3", SharedCfgPin::Addr(17)), + ("P6", SharedCfgPin::Tdi), + ("P7", SharedCfgPin::Tck), + ("P17", SharedCfgPin::Tms), + ("P64", SharedCfgPin::Hdc), + ("P68", SharedCfgPin::Ldc), + ("P89", SharedCfgPin::InitB), + ("P123", SharedCfgPin::Data(7)), + ("P129", SharedCfgPin::Data(6)), + ("P141", SharedCfgPin::Data(5)), + ("P142", SharedCfgPin::Cs0B), + ("P148", SharedCfgPin::Data(4)), + ("P152", SharedCfgPin::Data(3)), + ("P153", SharedCfgPin::RsB), + ("P159", SharedCfgPin::Data(2)), + ("P173", SharedCfgPin::Data(1)), + ("P174", SharedCfgPin::BusyB), + ("P177", SharedCfgPin::Data(0)), + ("P178", SharedCfgPin::Dout), + ("P183", SharedCfgPin::Addr(0)), + ("P184", SharedCfgPin::Addr(1)), + ("P187", SharedCfgPin::Addr(2)), + ("P188", SharedCfgPin::Addr(3)), + ("P202", SharedCfgPin::Addr(4)), + ("P203", SharedCfgPin::Addr(5)), + ("P209", SharedCfgPin::Addr(6)), + ("P210", SharedCfgPin::Addr(7)), + ]); + } + _ => (), + } + let mut cfg_io = BTreeMap::new(); + for (pin, fun) in pkg_cfg_io { + let BondPin::Io(io) = bond.pins[pin] else { + unreachable!() + }; + cfg_io.insert(fun, io); + } + + (bond, cfg_io) } diff --git a/prjcombine_xact_dump/src/xc5200.rs b/prjcombine_xact_dump/src/xc5200.rs index 663b88bf..af890f24 100644 --- a/prjcombine_xact_dump/src/xc5200.rs +++ b/prjcombine_xact_dump/src/xc5200.rs @@ -11,8 +11,8 @@ use prjcombine_int::{ use prjcombine_xact_data::die::Die; use prjcombine_xact_naming::db::{NamingDb, NodeNaming}; use prjcombine_xc5200::{ - bond::{Bond, BondPin}, - grid::Grid, + bond::{Bond, BondPin, CfgPin}, + grid::{Grid, IoCoord, SharedCfgPin}, }; use prjcombine_xc5200_xact::{name_device, ExpandedNamedDevice}; use unnamed_entity::{EntityId, EntityVec}; @@ -1169,7 +1169,11 @@ pub fn dump_grid(die: &Die) -> (Grid, IntDb, NamingDb) { (grid, intdb, ndb) } -pub fn make_bond(endev: &ExpandedNamedDevice, pkg: &BTreeMap) -> Bond { +pub fn make_bond( + endev: &ExpandedNamedDevice, + name: &str, + pkg: &BTreeMap, +) -> (Bond, BTreeMap) { let io_lookup: BTreeMap<_, _> = endev .edev .get_bonded_ios() @@ -1183,5 +1187,485 @@ pub fn make_bond(endev: &ExpandedNamedDevice, pkg: &BTreeMap) -> let io = io_lookup[&**pad]; bond.pins.insert(pin.into(), BondPin::Io(io)); } - bond + + let (gnd, vcc, done, prog, cclk) = match name { + "pc84" => ( + &["P1", "P12", "P21", "P31", "P43", "P52", "P64", "P76"][..], + &["P2", "P11", "P22", "P33", "P42", "P54", "P63", "P74"][..], + "P53", + "P55", + "P73", + ), + "pq100" => ( + &["P4", "P14", "P26", "P41", "P52", "P67", "P80", "P91"][..], + &["P3", "P15", "P28", "P40", "P54", "P66", "P78", "P92"][..], + "P53", + "P55", + "P77", + ), + "pq160" => ( + &[ + "P1", "P10", "P19", "P29", "P39", "P51", "P61", "P70", "P79", "P91", "P101", + "P110", "P122", "P131", "P141", "P151", + ][..], + &["P20", "P41", "P60", "P81", "P100", "P120", "P142", "P160"][..], + "P80", + "P82", + "P119", + ), + "pq208" | "hq208" => ( + &[ + "P2", "P14", "P25", "P37", "P49", "P67", "P79", "P90", "P101", "P119", "P131", + "P142", "P160", "P171", "P182", "P194", + ][..], + &["P26", "P55", "P78", "P106", "P130", "P154", "P183", "P205"][..], + "P103", + "P108", + "P153", + ), + "pq240" | "hq240" => ( + &[ + "P1", "P14", "P29", "P45", "P59", "P75", "P91", "P106", "P119", "P135", "P151", + "P166", "P182", "P196", "P211", "P227", + ][..], + &[ + "P19", "P30", "P40", "P61", "P80", "P90", "P101", "P121", "P140", "P150", "P161", + "P180", "P201", "P212", "P222", "P240", + ][..], + "P120", + "P122", + "P179", + ), + "hq304" => ( + &[ + "P19", "P39", "P58", "P75", "P95", "P114", "P134", "P154", "P171", "P190", "P210", + "P230", "P248", "P268", "P287", "P304", + ][..], + &[ + "P1", "P25", "P38", "P52", "P77", "P101", "P115", "P129", "P152", "P177", "P191", + "P204", "P228", "P253", "P267", "P282", + ][..], + "P153", + "P151", + "P78", + ), + "tq144" => ( + &[ + "P1", "P8", "P17", "P27", "P35", "P45", "P55", "P64", "P71", "P73", "P81", "P91", + "P100", "P110", "P118", "P127", "P137", + ][..], + &["P18", "P37", "P54", "P90", "P108", "P128", "P144"][..], + "P72", + "P74", + "P107", + ), + "tq176" => ( + &[ + "P1", "P10", "P22", "P33", "P43", "P55", "P67", "P78", "P87", "P99", "P111", + "P122", "P134", "P143", "P154", "P166", + ][..], + &["P21", "P45", "P66", "P89", "P110", "P132", "P155", "P176"][..], + "P88", + "P90", + "P131", + ), + "vq64" => ( + &["P8", "P25", "P41", "P56"][..], + &["P9", "P24", "P33", "P40", "P64"][..], + "P32", + "P34", + "P48", + ), + "vq100" => ( + &["P1", "P11", "P23", "P38", "P49", "P64", "P77", "P88"][..], + &["P12", "P25", "P37", "P51", "P63", "P75", "P89", "P100"][..], + "P50", + "P52", + "P74", + ), + "pg156" => ( + &[ + "F3", "C4", "C6", "C8", "C11", "C13", "F14", "J14", "L14", "P14", "P11", "P8", + "P6", "N3", "L3", "H2", + ][..], + &["H3", "C3", "B8", "C14", "H14", "P13", "R8", "P3"][..], + "R15", + "R14", + "R2", + ), + "pg191" => ( + &[ + "G3", "D4", "C7", "D9", "C12", "D15", "G16", "K15", "M16", "R16", "T12", "R9", + "T7", "R3", "M3", "K4", + ][..], + &["J4", "D3", "D10", "D16", "J15", "R15", "R10", "R4"][..], + "U17", + "V18", + "V1", + ), + "pg223" => ( + &[ + "G3", "D4", "C7", "D9", "C12", "D15", "G16", "K15", "M16", "R16", "T12", "R9", + "T7", "R3", "M3", "K4", + ][..], + &["J4", "D3", "D10", "D16", "J15", "R15", "R10", "R4"][..], + "U17", + "V18", + "V1", + ), + "pg299" => ( + &[ + "F1", "B1", "A5", "A10", "A15", "A19", "E20", "K20", "R20", "W20", "X16", "X11", + "X6", "X2", "T1", "L1", + ][..], + &[ + "K1", "E1", "A2", "A6", "A11", "A16", "B20", "F20", "L20", "T20", "X19", "X15", + "X10", "X5", "W1", "R1", + ][..], + "V18", + "U17", + "V3", + ), + "bg225" => ( + &[ + "A1", "D12", "G7", "G9", "H6", "H8", "H10", "J8", "K8", "A8", "F8", "G8", "H2", + "H7", "H9", "J7", "J9", "M8", + ][..], + &["B2", "D8", "H15", "R8", "B14", "R1", "H1", "R15"][..], + "P14", + "M12", + "C13", + ), + "bg352" => ( + &[ + "A1", "A2", "A5", "A8", "A14", "A19", "A22", "A25", "A26", "B1", "B26", "E1", + "E26", "H1", "H26", "N1", "P26", "W1", "W26", "AB1", "AB26", "AE1", "AE26", "AF1", + "AF13", "AF19", "AF2", "AF22", "AF25", "AF26", "AF5", "AF8", + ][..], + &[ + "A10", "A17", "B2", "B25", "D13", "D19", "D7", "G23", "H4", "K1", "K26", "N23", + "P4", "U1", "U26", "W23", "Y4", "AC14", "AC20", "AC8", "AE2", "AE25", "AF10", + "AF17", + ][..], + "AD3", + "AC4", + "C3", + ), + _ => panic!("ummm {name}?"), + }; + for &pin in gnd { + assert_eq!(bond.pins.insert(pin.to_string(), BondPin::Gnd), None); + } + for &pin in vcc { + assert_eq!(bond.pins.insert(pin.to_string(), BondPin::Vcc), None); + } + assert_eq!( + bond.pins + .insert(done.to_string(), BondPin::Cfg(CfgPin::Done)), + None + ); + assert_eq!( + bond.pins + .insert(prog.to_string(), BondPin::Cfg(CfgPin::ProgB)), + None + ); + assert_eq!( + bond.pins + .insert(cclk.to_string(), BondPin::Cfg(CfgPin::Cclk)), + None + ); + + let len1d = match name { + "pc84" => Some(84), + "pq100" => Some(100), + "pq160" => Some(160), + "pq208" | "hq208" => Some(208), + "pq240" | "hq240" => Some(240), + "hq304" => Some(304), + "tq144" => Some(144), + "tq176" => Some(176), + "vq100" => Some(100), + "vq64" => Some(64), + _ => None, + }; + if let Some(len1d) = len1d { + for i in 1..=len1d { + bond.pins.entry(format!("P{i}")).or_insert(BondPin::Nc); + } + assert_eq!(bond.pins.len(), len1d); + } + match name { + "bg225" => { + assert_eq!(bond.pins.len(), 225); + } + "bg352" => { + for a in ["A", "B", "C", "D", "AC", "AD", "AE", "AF"] { + for i in 1..=26 { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + for a in [ + "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "T", "U", "V", "W", "Y", + "AA", "AB", + ] { + for i in (1..=4).chain(23..=26) { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + assert_eq!(bond.pins.len(), 352); + } + "pg156" => { + for a in ["A", "B", "C", "P", "R", "T"] { + for i in 1..=16 { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + for a in ["D", "E", "F", "G", "H", "J", "K", "L", "M", "N"] { + for i in (1..=3).chain(14..=16) { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + assert_eq!(bond.pins.len(), 156); + } + "pg191" => { + for i in 2..=18 { + bond.pins.entry(format!("A{i}")).or_insert(BondPin::Nc); + } + for a in ["B", "C", "T", "U", "V"] { + for i in 1..=18 { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + for a in ["D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R"] { + for i in (1..=3).chain(16..=18) { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + for a in ["D", "R"] { + for i in [4, 9, 10, 15] { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + for a in ["J", "K"] { + for i in [4, 15] { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + assert_eq!(bond.pins.len(), 191); + } + "pg223" => { + for i in 2..=18 { + bond.pins.entry(format!("A{i}")).or_insert(BondPin::Nc); + } + for a in ["B", "C", "D", "R", "T", "U", "V"] { + for i in 1..=18 { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + for a in ["E", "F", "G", "H", "J", "K", "L", "M", "N", "P"] { + for i in (1..=4).chain(15..=18) { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + assert_eq!(bond.pins.len(), 223); + } + "pg299" => { + for i in 2..=20 { + bond.pins.entry(format!("A{i}")).or_insert(BondPin::Nc); + } + for a in ["B", "C", "D", "E", "T", "U", "V", "W", "X"] { + for i in 1..=20 { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + for a in ["F", "G", "H", "J", "K", "L", "M", "N", "P", "R"] { + for i in (1..=5).chain(16..=20) { + bond.pins.entry(format!("{a}{i}")).or_insert(BondPin::Nc); + } + } + assert_eq!(bond.pins.len(), 299); + } + _ => (), + } + + let pkg_cfg_io = match name { + "pc84" => &[ + ("P3", SharedCfgPin::Addr(8)), + ("P4", SharedCfgPin::Addr(9)), + ("P5", SharedCfgPin::Addr(10)), + ("P6", SharedCfgPin::Addr(11)), + ("P7", SharedCfgPin::Addr(12)), + ("P8", SharedCfgPin::Addr(13)), + ("P9", SharedCfgPin::Addr(14)), + ("P10", SharedCfgPin::Addr(15)), + ("P13", SharedCfgPin::Addr(16)), + ("P14", SharedCfgPin::Addr(17)), + ("P15", SharedCfgPin::Tdi), + ("P16", SharedCfgPin::Tck), + ("P17", SharedCfgPin::Tms), + ("P30", SharedCfgPin::M1), + ("P32", SharedCfgPin::M0), + ("P34", SharedCfgPin::M2), + ("P36", SharedCfgPin::Hdc), + ("P37", SharedCfgPin::Ldc), + ("P41", SharedCfgPin::InitB), + ("P56", SharedCfgPin::Data(7)), + ("P58", SharedCfgPin::Data(6)), + ("P59", SharedCfgPin::Data(5)), + ("P60", SharedCfgPin::Cs0B), + ("P61", SharedCfgPin::Data(4)), + ("P65", SharedCfgPin::Data(3)), + ("P66", SharedCfgPin::RsB), + ("P67", SharedCfgPin::Data(2)), + ("P69", SharedCfgPin::Data(1)), + ("P70", SharedCfgPin::BusyB), + ("P71", SharedCfgPin::Data(0)), + ("P72", SharedCfgPin::Dout), + ("P75", SharedCfgPin::Tdo), + ("P77", SharedCfgPin::Addr(0)), + ("P78", SharedCfgPin::Addr(1)), + ("P79", SharedCfgPin::Addr(2)), + ("P80", SharedCfgPin::Addr(3)), + ("P81", SharedCfgPin::Addr(4)), + ("P82", SharedCfgPin::Addr(5)), + ("P83", SharedCfgPin::Addr(6)), + ("P84", SharedCfgPin::Addr(7)), + ][..], + "pq160" => &[ + ("P143", SharedCfgPin::Addr(8)), + ("P144", SharedCfgPin::Addr(9)), + ("P147", SharedCfgPin::Addr(10)), + ("P148", SharedCfgPin::Addr(11)), + ("P154", SharedCfgPin::Addr(12)), + ("P155", SharedCfgPin::Addr(13)), + ("P158", SharedCfgPin::Addr(14)), + ("P159", SharedCfgPin::Addr(15)), + ("P2", SharedCfgPin::Addr(16)), + ("P3", SharedCfgPin::Addr(17)), + ("P6", SharedCfgPin::Tdi), + ("P7", SharedCfgPin::Tck), + ("P13", SharedCfgPin::Tms), + ("P38", SharedCfgPin::M1), + ("P40", SharedCfgPin::M0), + ("P42", SharedCfgPin::M2), + ("P44", SharedCfgPin::Hdc), + ("P48", SharedCfgPin::Ldc), + ("P59", SharedCfgPin::InitB), + ("P83", SharedCfgPin::Data(7)), + ("P87", SharedCfgPin::Data(6)), + ("P94", SharedCfgPin::Data(5)), + ("P95", SharedCfgPin::Cs0B), + ("P98", SharedCfgPin::Data(4)), + ("P102", SharedCfgPin::Data(3)), + ("P103", SharedCfgPin::RsB), + ("P106", SharedCfgPin::Data(2)), + ("P113", SharedCfgPin::Data(1)), + ("P114", SharedCfgPin::BusyB), + ("P117", SharedCfgPin::Data(0)), + ("P118", SharedCfgPin::Dout), + ("P121", SharedCfgPin::Tdo), + ("P123", SharedCfgPin::Addr(0)), + ("P124", SharedCfgPin::Addr(1)), + ("P127", SharedCfgPin::Addr(2)), + ("P128", SharedCfgPin::Addr(3)), + ("P134", SharedCfgPin::Addr(4)), + ("P135", SharedCfgPin::Addr(5)), + ("P139", SharedCfgPin::Addr(6)), + ("P140", SharedCfgPin::Addr(7)), + ][..], + "pq208" => &[ + ("P184", SharedCfgPin::Addr(8)), + ("P185", SharedCfgPin::Addr(9)), + ("P190", SharedCfgPin::Addr(10)), + ("P191", SharedCfgPin::Addr(11)), + ("P199", SharedCfgPin::Addr(12)), + ("P200", SharedCfgPin::Addr(13)), + ("P203", SharedCfgPin::Addr(14)), + ("P204", SharedCfgPin::Addr(15)), + ("P4", SharedCfgPin::Addr(16)), + ("P5", SharedCfgPin::Addr(17)), + ("P8", SharedCfgPin::Tdi), + ("P9", SharedCfgPin::Tck), + ("P17", SharedCfgPin::Tms), + ("P48", SharedCfgPin::M1), + ("P50", SharedCfgPin::M0), + ("P56", SharedCfgPin::M2), + ("P58", SharedCfgPin::Hdc), + ("P62", SharedCfgPin::Ldc), + ("P77", SharedCfgPin::InitB), + ("P109", SharedCfgPin::Data(7)), + ("P113", SharedCfgPin::Data(6)), + ("P122", SharedCfgPin::Data(5)), + ("P123", SharedCfgPin::Cs0B), + ("P128", SharedCfgPin::Data(4)), + ("P132", SharedCfgPin::Data(3)), + ("P133", SharedCfgPin::RsB), + ("P138", SharedCfgPin::Data(2)), + ("P147", SharedCfgPin::Data(1)), + ("P148", SharedCfgPin::BusyB), + ("P151", SharedCfgPin::Data(0)), + ("P152", SharedCfgPin::Dout), + ("P159", SharedCfgPin::Tdo), + ("P161", SharedCfgPin::Addr(0)), + ("P162", SharedCfgPin::Addr(1)), + ("P165", SharedCfgPin::Addr(2)), + ("P166", SharedCfgPin::Addr(3)), + ("P174", SharedCfgPin::Addr(4)), + ("P175", SharedCfgPin::Addr(5)), + ("P180", SharedCfgPin::Addr(6)), + ("P181", SharedCfgPin::Addr(7)), + ][..], + "pq240" => &[ + ("P213", SharedCfgPin::Addr(8)), + ("P214", SharedCfgPin::Addr(9)), + ("P220", SharedCfgPin::Addr(10)), + ("P221", SharedCfgPin::Addr(11)), + ("P232", SharedCfgPin::Addr(12)), + ("P233", SharedCfgPin::Addr(13)), + ("P238", SharedCfgPin::Addr(14)), + ("P239", SharedCfgPin::Addr(15)), + ("P2", SharedCfgPin::Addr(16)), + ("P3", SharedCfgPin::Addr(17)), + ("P6", SharedCfgPin::Tdi), + ("P7", SharedCfgPin::Tck), + ("P17", SharedCfgPin::Tms), + ("P58", SharedCfgPin::M1), + ("P60", SharedCfgPin::M0), + ("P62", SharedCfgPin::M2), + ("P64", SharedCfgPin::Hdc), + ("P68", SharedCfgPin::Ldc), + ("P89", SharedCfgPin::InitB), + ("P123", SharedCfgPin::Data(7)), + ("P129", SharedCfgPin::Data(6)), + ("P141", SharedCfgPin::Data(5)), + ("P142", SharedCfgPin::Cs0B), + ("P148", SharedCfgPin::Data(4)), + ("P152", SharedCfgPin::Data(3)), + ("P153", SharedCfgPin::RsB), + ("P159", SharedCfgPin::Data(2)), + ("P173", SharedCfgPin::Data(1)), + ("P174", SharedCfgPin::BusyB), + ("P177", SharedCfgPin::Data(0)), + ("P178", SharedCfgPin::Dout), + ("P181", SharedCfgPin::Tdo), + ("P183", SharedCfgPin::Addr(0)), + ("P184", SharedCfgPin::Addr(1)), + ("P187", SharedCfgPin::Addr(2)), + ("P188", SharedCfgPin::Addr(3)), + ("P202", SharedCfgPin::Addr(4)), + ("P203", SharedCfgPin::Addr(5)), + ("P209", SharedCfgPin::Addr(6)), + ("P210", SharedCfgPin::Addr(7)), + ][..], + _ => &[][..], + }; + let mut cfg_io = BTreeMap::new(); + for &(pin, fun) in pkg_cfg_io { + let BondPin::Io(io) = bond.pins[pin] else { + unreachable!() + }; + cfg_io.insert(fun, io); + } + + (bond, cfg_io) } diff --git a/prjcombine_xc2000/src/bond.rs b/prjcombine_xc2000/src/bond.rs index 4af9e686..f97c589b 100644 --- a/prjcombine_xc2000/src/bond.rs +++ b/prjcombine_xc2000/src/bond.rs @@ -21,6 +21,7 @@ pub enum BondPin { Io(IoCoord), Gnd, Vcc, + Nc, Cfg(CfgPin), } @@ -63,6 +64,7 @@ impl Display for Bond { } BondPin::Gnd => write!(f, "GND")?, BondPin::Vcc => write!(f, "VCC")?, + BondPin::Nc => write!(f, "NC")?, BondPin::Cfg(CfgPin::Cclk) => write!(f, "CCLK")?, BondPin::Cfg(CfgPin::Done) => write!(f, "DONE")?, BondPin::Cfg(CfgPin::ProgB) => write!(f, "PROG_B")?, diff --git a/prjcombine_xc2000/src/grid.rs b/prjcombine_xc2000/src/grid.rs index e695a6b4..9725448f 100644 --- a/prjcombine_xc2000/src/grid.rs +++ b/prjcombine_xc2000/src/grid.rs @@ -24,11 +24,9 @@ pub enum SharedCfgPin { Data(u8), Ldc, Hdc, - Rclk, + RclkB, Dout, M2, - Xtl1, - Xtl2, } #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] @@ -60,6 +58,22 @@ impl Grid { pub fn row_mid(&self) -> RowId { RowId::from_idx(self.rows / 2 - 1) } + + pub fn io_xtl1(&self) -> IoCoord { + IoCoord { + col: self.col_rio(), + row: self.row_bio(), + iob: TileIobId::from_idx(1), + } + } + + pub fn io_xtl2(&self) -> IoCoord { + IoCoord { + col: self.col_rio(), + row: self.row_bio(), + iob: TileIobId::from_idx(2), + } + } } impl Display for Grid {