Skip to content

Commit

Permalink
ise_hammer: 5v CLB OCD compliance.
Browse files Browse the repository at this point in the history
  • Loading branch information
wanda-phi committed May 31, 2024
1 parent 5c7a549 commit 5136a57
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 31 deletions.
2 changes: 1 addition & 1 deletion databases/xc5v-tiledb.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion databases/xc6s-tiledb.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion databases/xc6v-tiledb.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion databases/xc7v-tiledb.json

Large diffs are not rendered by default.

70 changes: 43 additions & 27 deletions prjcombine_ise_hammer/src/clb/virtex5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use unnamed_entity::EntityId;

use crate::{
backend::{IseBackend, SimpleFeatureId},
diff::{xlat_bitvec, xlat_enum, CollectorCtx, Diff},
diff::{xlat_bitvec, xlat_enum, xlat_enum_default, CollectorCtx, Diff, OcdMode},
fgen::{TileBits, TileFuzzKV, TileFuzzerGen, TileRelation, TileWire},
fuzz::FuzzCtx,
fuzz_enum, fuzz_multi,
Expand Down Expand Up @@ -930,56 +930,72 @@ pub fn collect_fuzzers(ctx: &mut CollectorCtx) {
ctx.collect_enum(tile, bel, "DFFMUX", &["O6", "DX"]);
} else {
if mode == Mode::Virtex5 {
ctx.collect_enum(tile, bel, "AOUTMUX", &["O5", "O6", "XOR", "CY", "F7"]);
ctx.collect_enum(tile, bel, "BOUTMUX", &["O5", "O6", "XOR", "CY", "F8"]);
ctx.collect_enum(tile, bel, "COUTMUX", &["O5", "O6", "XOR", "CY", "F7"]);
ctx.collect_enum_default_ocd(tile, bel, "AOUTMUX", &["O6", "O5", "XOR", "CY", "F7"], "NONE", OcdMode::Mux);
ctx.collect_enum_default_ocd(tile, bel, "BOUTMUX", &["O6", "O5", "XOR", "CY", "F8"], "NONE", OcdMode::Mux);
ctx.collect_enum_default_ocd(tile, bel, "COUTMUX", &["O6", "O5", "XOR", "CY", "F7"], "NONE", OcdMode::Mux);
if is_m {
ctx.collect_enum(tile, bel, "DOUTMUX", &["O5", "O6", "XOR", "CY", "MC31"]);
ctx.collect_enum_default_ocd(tile, bel, "DOUTMUX", &["O6", "O5", "XOR", "CY", "MC31"], "NONE", OcdMode::Mux);
} else {
ctx.collect_enum(tile, bel, "DOUTMUX", &["O5", "O6", "XOR", "CY"]);
ctx.collect_enum_default_ocd(tile, bel, "DOUTMUX", &["O6", "O5", "XOR", "CY"], "NONE", OcdMode::Mux);
}
} else {
ctx.collect_enum(
ctx.collect_enum_default_ocd(
tile,
bel,
"AOUTMUX",
&["O5", "O6", "XOR", "CY", "A5Q", "F7"],
&["O6", "O5", "XOR", "CY", "A5Q", "F7"], "NONE", OcdMode::Mux,
);
ctx.collect_enum(
ctx.collect_enum_default_ocd(
tile,
bel,
"BOUTMUX",
&["O5", "O6", "XOR", "CY", "B5Q", "F8"],
&["O6", "O5", "XOR", "CY", "B5Q", "F8"], "NONE", OcdMode::Mux,
);
ctx.collect_enum(
ctx.collect_enum_default_ocd(
tile,
bel,
"COUTMUX",
&["O5", "O6", "XOR", "CY", "C5Q", "F7"],
&["O6", "O5", "XOR", "CY", "C5Q", "F7"], "NONE", OcdMode::Mux,
);
if is_m {
ctx.collect_enum(
ctx.collect_enum_default_ocd(
tile,
bel,
"DOUTMUX",
&["O5", "O6", "XOR", "CY", "D5Q", "MC31"],
&["O6", "O5", "XOR", "CY", "D5Q", "MC31"], "NONE", OcdMode::Mux,
);
} else {
ctx.collect_enum(tile, bel, "DOUTMUX", &["O5", "O6", "XOR", "CY", "D5Q"]);
ctx.collect_enum_default_ocd(tile, bel, "DOUTMUX", &["O6", "O5", "XOR", "CY", "D5Q"], "NONE", OcdMode::Mux);
}
}
ctx.collect_enum(tile, bel, "AFFMUX", &["O5", "O6", "XOR", "CY", "AX", "F7"]);
ctx.collect_enum(tile, bel, "BFFMUX", &["O5", "O6", "XOR", "CY", "BX", "F8"]);
ctx.collect_enum(tile, bel, "CFFMUX", &["O5", "O6", "XOR", "CY", "CX", "F7"]);
if is_m {
ctx.collect_enum(
tile,
bel,
"DFFMUX",
&["O5", "O6", "XOR", "CY", "DX", "MC31"],
);
if mode == Mode::Spartan6 {
ctx.collect_enum(tile, bel, "AFFMUX", &["O6", "O5", "XOR", "CY", "AX", "F7"]);
ctx.collect_enum(tile, bel, "BFFMUX", &["O6", "O5", "XOR", "CY", "BX", "F8"]);
ctx.collect_enum(tile, bel, "CFFMUX", &["O6", "O5", "XOR", "CY", "CX", "F7"]);
if is_m {
ctx.collect_enum(
tile,
bel,
"DFFMUX",
&["O6", "O5", "XOR", "CY", "DX", "MC31"],
);
} else {
ctx.collect_enum(tile, bel, "DFFMUX", &["O6", "O5", "XOR", "CY", "DX"]);
}
} else {
ctx.collect_enum(tile, bel, "DFFMUX", &["O5", "O6", "XOR", "CY", "DX"]);
ctx.collect_enum_default_ocd(tile, bel, "AFFMUX", &["O6", "O5", "XOR", "CY", "AX", "F7"], "NONE", OcdMode::Mux);
ctx.collect_enum_default_ocd(tile, bel, "BFFMUX", &["O6", "O5", "XOR", "CY", "BX", "F8"], "NONE", OcdMode::Mux);
ctx.collect_enum_default_ocd(tile, bel, "CFFMUX", &["O6", "O5", "XOR", "CY", "CX", "F7"], "NONE", OcdMode::Mux);
if is_m {
ctx.collect_enum_default_ocd(
tile,
bel,
"DFFMUX",
&["O6", "O5", "XOR", "CY", "DX", "MC31"], "NONE", OcdMode::Mux,
);
} else {
ctx.collect_enum_default_ocd(tile, bel, "DFFMUX", &["O6", "O5", "XOR", "CY", "DX"], "NONE", OcdMode::Mux);
}
}
if matches!(mode, Mode::Virtex6 | Mode::Virtex7) {
for (attr, byp) in [
Expand All @@ -994,7 +1010,7 @@ pub fn collect_fuzzers(ctx: &mut CollectorCtx) {
tile,
bel,
attr,
xlat_enum(vec![("O5".to_string(), d_o5), (byp.to_string(), d_byp)]),
xlat_enum_default(vec![("O5".to_string(), d_o5), (byp.to_string(), d_byp)], "NONE"),
);
}
}
Expand Down
26 changes: 26 additions & 0 deletions prjcombine_ise_hammer/src/diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,15 @@ pub fn xlat_enum_default(
xlat_enum(diffs)
}

pub fn xlat_enum_default_ocd(
mut diffs: Vec<(String, Diff)>,
default: impl Into<String>,
ocd: OcdMode,
) -> TileItem<FeatureBit> {
diffs.insert(0, (default.into(), Diff::default()));
xlat_enum_inner(diffs, ocd)
}

pub fn xlat_bool(diff0: Diff, diff1: Diff) -> TileItem<FeatureBit> {
let diff = if diff0.bits.is_empty() {
diff0.assert_empty();
Expand Down Expand Up @@ -320,6 +329,23 @@ impl<'a, 'b: 'a> CollectorCtx<'a, 'b> {
self.tiledb.insert(tile, bel, attr, ti);
}

pub fn collect_enum_default_ocd(
&mut self,
tile: &'b str,
bel: &'b str,
attr: &'b str,
vals: &[&'b str],
default: &'b str,
ocd: OcdMode,
) {
let diffs = vals
.iter()
.map(|val| (val.to_string(), self.state.get_diff(tile, bel, attr, val)))
.collect();
let ti = xlat_enum_default_ocd(diffs, default, ocd);
self.tiledb.insert(tile, bel, attr, ti);
}

pub fn extract_enum_bool(
&mut self,
tile: &'b str,
Expand Down

0 comments on commit 5136a57

Please sign in to comment.