Skip to content

Commit

Permalink
xc4000h: take note of unbonded IO.
Browse files Browse the repository at this point in the history
  • Loading branch information
wanda-phi committed Dec 19, 2024
1 parent 00b41c7 commit eaf2f64
Show file tree
Hide file tree
Showing 35 changed files with 107 additions and 25 deletions.
2 changes: 1 addition & 1 deletion databases/spartanxl.json

Large diffs are not rendered by default.

Binary file modified databases/spartanxl.zstd
Binary file not shown.
2 changes: 1 addition & 1 deletion databases/xc2000.json

Large diffs are not rendered by default.

Binary file modified databases/xc2000.zstd
Binary file not shown.
2 changes: 1 addition & 1 deletion databases/xc3000.json

Large diffs are not rendered by default.

Binary file modified databases/xc3000.zstd
Binary file not shown.
2 changes: 1 addition & 1 deletion databases/xc3000a.json

Large diffs are not rendered by default.

Binary file modified databases/xc3000a.zstd
Binary file not shown.
2 changes: 1 addition & 1 deletion databases/xc4000.json

Large diffs are not rendered by default.

Binary file modified databases/xc4000.zstd
Binary file not shown.
2 changes: 1 addition & 1 deletion databases/xc4000a.json

Large diffs are not rendered by default.

Binary file modified databases/xc4000a.zstd
Binary file not shown.
2 changes: 1 addition & 1 deletion databases/xc4000e.json

Large diffs are not rendered by default.

Binary file modified databases/xc4000e.zstd
Binary file not shown.
2 changes: 1 addition & 1 deletion databases/xc4000ex.json

Large diffs are not rendered by default.

Binary file modified databases/xc4000ex.zstd
Binary file not shown.
2 changes: 1 addition & 1 deletion databases/xc4000h.json

Large diffs are not rendered by default.

Binary file modified databases/xc4000h.zstd
Binary file not shown.
2 changes: 1 addition & 1 deletion databases/xc4000xla.json

Large diffs are not rendered by default.

Binary file modified databases/xc4000xla.zstd
Binary file not shown.
2 changes: 1 addition & 1 deletion databases/xc4000xv.json

Large diffs are not rendered by default.

Binary file modified databases/xc4000xv.zstd
Binary file not shown.
2 changes: 1 addition & 1 deletion databases/xc5200.json

Large diffs are not rendered by default.

Binary file modified databases/xc5200.zstd
Binary file not shown.
5 changes: 4 additions & 1 deletion prjcombine_xact_dump/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ fn main() {
GridKind::Xc3000
},
),
PartKind::Xc4000 => xc4000::dump_grid(&die),
PartKind::Xc4000 => xc4000::dump_grid(
&die,
part.kv.get("NOBLOCK").map(|x| &x[..]).unwrap_or(&[]),
),
PartKind::Xc5200 => xc5200::dump_grid(&die),
PartKind::Xc7000 => unreachable!(),
};
Expand Down
3 changes: 2 additions & 1 deletion prjcombine_xact_dump/src/xc2000.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::{BTreeMap, BTreeSet};
use enum_map::EnumMap;
use prjcombine_int::{
db::{BelInfo, BelPin, Dir, IntDb, NodeKind, NodeTileId, PinDir, TermInfo, TermKind, WireKind},
grid::{ColId, DieId, LayerId, RowId, EdgeIoCoord},
grid::{ColId, DieId, EdgeIoCoord, LayerId, RowId},
};
use prjcombine_xact_data::die::Die;
use prjcombine_xact_naming::db::{NamingDb, NodeNaming};
Expand Down Expand Up @@ -327,6 +327,7 @@ pub fn make_grid(die: &Die) -> Grid {
is_small: false,
is_buff_large: false,
cfg_io: Default::default(),
unbonded_io: BTreeSet::new(),
}
}

Expand Down
3 changes: 2 additions & 1 deletion prjcombine_xact_dump/src/xc3000.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::{BTreeMap, BTreeSet};
use enum_map::EnumMap;
use prjcombine_int::{
db::{BelInfo, BelPin, Dir, IntDb, NodeKind, NodeTileId, PinDir, TermInfo, TermKind, WireKind},
grid::{DieId, LayerId, EdgeIoCoord},
grid::{DieId, EdgeIoCoord, LayerId},
};
use prjcombine_xact_data::die::Die;
use prjcombine_xact_naming::db::{NamingDb, NodeNaming};
Expand Down Expand Up @@ -431,6 +431,7 @@ pub fn make_grid(die: &Die, kind: GridKind) -> Grid {
is_small: clb_x.len() == 8,
is_buff_large: false,
cfg_io: Default::default(),
unbonded_io: BTreeSet::new(),
}
}

Expand Down
18 changes: 16 additions & 2 deletions prjcombine_xact_dump/src/xc4000.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,11 +805,12 @@ pub fn make_grid(die: &Die) -> Grid {
is_small: false,
cols_bidi: Default::default(),
rows_bidi: Default::default(),
unbonded_io: BTreeSet::new(),
}
}

pub fn dump_grid(die: &Die) -> (Grid, IntDb, NamingDb) {
let grid = make_grid(die);
pub fn dump_grid(die: &Die, noblock: &[String]) -> (Grid, IntDb, NamingDb) {
let mut grid = make_grid(die);
let mut intdb = make_intdb(grid.kind);
let mut ndb = NamingDb::default();
for name in intdb.nodes.keys() {
Expand Down Expand Up @@ -1746,8 +1747,21 @@ pub fn dump_grid(die: &Die) -> (Grid, IntDb, NamingDb) {
}
}

let io_lookup: BTreeMap<_, _> = endev
.grid
.get_bonded_ios()
.into_iter()
.map(|io| (endev.get_io_name(io).to_string(), io))
.collect();

let finisher = extractor.finish();
finisher.finish(&mut intdb, &mut ndb);

for pad in noblock {
let io = io_lookup[pad];
grid.unbonded_io.insert(io);
}

(grid, intdb, ndb)
}

Expand Down
1 change: 1 addition & 0 deletions prjcombine_xact_dump/src/xc5200.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ pub fn make_grid(die: &Die) -> Grid {
is_buff_large: false,
cols_bidi: Default::default(),
rows_bidi: Default::default(),
unbonded_io: BTreeSet::new(),
}
}

Expand Down
9 changes: 6 additions & 3 deletions prjcombine_xact_hammer/src/fbuild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ use prjcombine_int::{
use crate::{
backend::{Key, Value, XactBackend},
fgen::{
BaseBelConfig, BaseBelMode, BaseBelMutex, BaseRaw, ExtraTile, FuzzBelConfig,
FuzzBelConfigDiff, FuzzBelMode, FuzzBelPipBufg, FuzzBelPipPin, FuzzEquate, FuzzEquateFixed,
FuzzRaw, PinMutexExclusive, Prop, XactFuzzerGen,
BaseBelConfig, BaseBelMode, BaseBelMutex, BaseRaw, BondedIo, ExtraTile, FuzzBelConfig, FuzzBelConfigDiff, FuzzBelMode, FuzzBelPipBufg, FuzzBelPipPin, FuzzEquate, FuzzEquateFixed, FuzzRaw, PinMutexExclusive, Prop, XactFuzzerGen
},
};

Expand Down Expand Up @@ -331,6 +329,11 @@ impl<'sm, 'a> FuzzBuilderBel<'sm, 'a> {
self.prop(prop)
}

pub fn bonded_io(self) -> Self {
let prop = BondedIo::new(self.bel);
self.prop(prop)
}

pub fn global(self, attr: impl Into<String>, val: impl Into<String>) -> Self {
self.prop(BaseRaw::new(Key::GlobalOpt(attr.into()), val.into().into()))
}
Expand Down
31 changes: 31 additions & 0 deletions prjcombine_xact_hammer/src/fgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,37 @@ impl Prop for FuzzBelPipPin {
}
}

#[derive(Clone, Debug)]
pub struct BondedIo {
pub bel: BelId,
}

impl BondedIo {
pub fn new(bel: BelId) -> Self {
Self { bel }
}
}

impl Prop for BondedIo {
fn dyn_clone(&self) -> Box<dyn Prop> {
Box::new(Clone::clone(self))
}

fn apply<'a>(
&self,
backend: &XactBackend<'a>,
nloc: NodeLoc,
fuzzer: Fuzzer<XactBackend<'a>>,
) -> Option<(Fuzzer<XactBackend<'a>>, bool)> {
let io = backend.edev.grid.get_io_crd(nloc.1, nloc.2, self.bel);
if backend.edev.grid.unbonded_io.contains(&io) {
None
} else {
Some((fuzzer, false))
}
}
}

pub fn get_bits(backend: &XactBackend, nloc: NodeLoc) -> Vec<BitTile> {
let edev = backend.edev;
let node = backend.egrid.node(nloc);
Expand Down
24 changes: 20 additions & 4 deletions prjcombine_xact_hammer/src/xc4000/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,35 +75,51 @@ pub fn add_fuzzers<'a>(session: &mut Session<'a, XactBackend<'a>>, backend: &'a
for bel in ["HIOB0", "HIOB1", "HIOB2", "HIOB3"] {
let mut bctx = ctx.bel(bel);
bctx.mode("IO")
.bonded_io()
.cfg("IN", "I")
.test_enum("PAD", &["PULLDOWN", "PULLUP"]);
bctx.mode("IO")
.bonded_io()
.cfg("IN", "I")
.cfg("OUT", "O")
.test_enum("TRI", &["TS", "TP"]);
bctx.mode("IO")
.bonded_io()
.cfg("IN", "I")
.cfg("OUT", "O")
.test_cfg("TRI", "NOT");
bctx.mode("IO").test_cfg("IN", "I");
bctx.mode("IO").cfg("IN", "I").test_cfg("IN", "NOT");
bctx.mode("IO").bonded_io().test_cfg("IN", "I");
bctx.mode("IO")
.bonded_io()
.cfg("IN", "I")
.test_cfg("IN", "NOT");
bctx.mode("IO")
.bonded_io()
.cfg("IN", "I")
.test_enum("IN", &["CMOS", "TTL"]);
bctx.mode("IO").cfg("IN", "I").test_cfg("OUT", "O");
bctx.mode("IO")
.bonded_io()
.cfg("IN", "I")
.test_cfg("OUT", "O");
bctx.mode("IO")
.bonded_io()
.cfg("IN", "I")
.cfg("OUT", "O")
.test_cfg("OUT", "NOT");
bctx.mode("IO")
.bonded_io()
.cfg("IN", "I")
.cfg("OUT", "O")
.test_enum("OUT", &["CMOS", "TTL"]);
bctx.mode("IO")
.bonded_io()
.cfg("IN", "I")
.cfg("OUT", "O")
.test_enum("OUT", &["CAP", "RES"]);
bctx.mode("IO").cfg("IN", "I").test_cfg("RDBK", "I");
bctx.mode("IO")
.bonded_io()
.cfg("IN", "I")
.test_cfg("RDBK", "I");
}
}
for bel in ["DEC0", "DEC1", "DEC2"] {
Expand Down
8 changes: 8 additions & 0 deletions prjcombine_xc2000/src/grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ pub struct Grid {
pub cols_bidi: BTreeSet<ColId>,
pub rows_bidi: BTreeSet<RowId>,
pub cfg_io: BTreeMap<SharedCfgPin, EdgeIoCoord>,
pub unbonded_io: BTreeSet<EdgeIoCoord>,
}

impl Grid {
Expand Down Expand Up @@ -545,6 +546,7 @@ impl Grid {
SharedCfgPin::M1 => "M1".to_string(),
}, io.to_string().into())
})),
"unbonded_io": Vec::from_iter(self.unbonded_io.iter().map(|&io| io.to_string())),
})
}
}
Expand All @@ -569,6 +571,12 @@ impl Display for Grid {
for (k, v) in &self.cfg_io {
writeln!(f, "\t\t{k:?}: {v}")?;
}
if !self.unbonded_io.is_empty() {
writeln!(f, "\tUNBONDED IO:")?;
for &io in &self.unbonded_io {
writeln!(f, "\t\t{io}")?;
}
}
Ok(())
}
}
3 changes: 2 additions & 1 deletion prjcombine_xc4000_rd2db/src/grid.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use prjcombine_int::db::BelId;
use prjcombine_rawdump::{Part, TkSiteSlot};
use prjcombine_xc2000::grid::{Grid, GridKind, SharedCfgPin};
use std::collections::{BTreeMap, HashMap};
use std::collections::{BTreeMap, BTreeSet, HashMap};
use unnamed_entity::EntityId;

use prjcombine_rdgrid::{extract_int, IntGrid};
Expand Down Expand Up @@ -72,6 +72,7 @@ pub fn make_grid(rd: &Part) -> Grid {
is_small: false,
cols_bidi: Default::default(),
rows_bidi: Default::default(),
unbonded_io: BTreeSet::new(),
};
handle_spec_io(rd, &mut grid, &int);
grid
Expand Down
3 changes: 3 additions & 0 deletions prjcombine_xc5200_rd2db/src/grid.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::collections::BTreeSet;

use prjcombine_rawdump::Part;
use prjcombine_xc2000::grid::{Grid, GridKind};

Expand All @@ -15,5 +17,6 @@ pub fn make_grid(rd: &Part) -> Grid {
is_buff_large: false,
cols_bidi: Default::default(),
rows_bidi: Default::default(),
unbonded_io: BTreeSet::new(),
}
}

0 comments on commit eaf2f64

Please sign in to comment.