-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add untested bscan order code to xc2000, virtex, virtex2, spartan6.
- Loading branch information
Showing
22 changed files
with
606 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
use std::collections::BTreeMap; | ||
|
||
use prjcombine_int::grid::{EdgeIoCoord, TileIobId}; | ||
use prjcombine_types::bscan::{BScanBuilder, BScanPin}; | ||
use unnamed_entity::EntityId; | ||
|
||
use crate::{ | ||
bond::CfgPin, | ||
grid::{ColumnIoKind, Grid}, | ||
}; | ||
|
||
#[derive(Debug)] | ||
pub struct BScan { | ||
pub bits: usize, | ||
pub io: BTreeMap<EdgeIoCoord, BScanPin>, | ||
pub cfg: BTreeMap<CfgPin, BScanPin>, | ||
} | ||
|
||
impl Grid { | ||
pub fn get_bscan(&self) -> BScan { | ||
let mut io = BTreeMap::new(); | ||
let mut cfg = BTreeMap::new(); | ||
let mut builder = BScanBuilder::new(); | ||
// TIO | ||
for (col, &cd) in self.columns.iter().rev() { | ||
if cd.tio == ColumnIoKind::None { | ||
continue; | ||
} | ||
for (iob, unused) in [ | ||
// inner | ||
(0, cd.tio == ColumnIoKind::Outer), | ||
(1, cd.tio == ColumnIoKind::Outer), | ||
// outer | ||
(2, cd.tio == ColumnIoKind::Inner), | ||
(3, cd.tio == ColumnIoKind::Inner), | ||
] { | ||
if !unused { | ||
let crd = EdgeIoCoord::T(col, TileIobId::from_idx(iob)); | ||
io.insert(crd, builder.get_toi()); | ||
} | ||
} | ||
} | ||
// LIO | ||
for (row, &rd) in self.rows.iter().rev() { | ||
if rd.lio { | ||
for iob in [0, 1] { | ||
let crd = EdgeIoCoord::L(row, TileIobId::from_idx(iob)); | ||
io.insert(crd, builder.get_toi()); | ||
} | ||
} | ||
} | ||
cfg.insert(CfgPin::ProgB, builder.get_toi()); | ||
// BIO | ||
for (col, &cd) in &self.columns { | ||
if cd.bio == ColumnIoKind::None { | ||
continue; | ||
} | ||
for (iob, unused) in [ | ||
// inner | ||
(0, cd.bio == ColumnIoKind::Outer), | ||
(1, cd.bio == ColumnIoKind::Outer), | ||
// outer | ||
(2, cd.bio == ColumnIoKind::Inner), | ||
(3, cd.bio == ColumnIoKind::Inner), | ||
] { | ||
if !unused { | ||
let crd = EdgeIoCoord::B(col, TileIobId::from_idx(iob)); | ||
io.insert(crd, builder.get_toi()); | ||
} | ||
} | ||
} | ||
cfg.insert(CfgPin::Done, builder.get_toi()); | ||
cfg.insert(CfgPin::CmpCsB, builder.get_toi()); | ||
cfg.insert(CfgPin::Suspend, builder.get_toi()); | ||
// RIO | ||
for (row, &rd) in &self.rows { | ||
if rd.rio { | ||
for iob in [0, 1] { | ||
let crd = EdgeIoCoord::R(row, TileIobId::from_idx(iob)); | ||
io.insert(crd, builder.get_toi()); | ||
} | ||
} | ||
} | ||
BScan { | ||
bits: builder.bits, | ||
io, | ||
cfg, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod bond; | ||
pub mod bscan; | ||
pub mod db; | ||
mod expand; | ||
pub mod expanded; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)] | ||
pub enum BScanPin { | ||
Input(usize), | ||
Output(usize), | ||
OutputTristate(usize, usize), | ||
OutputEnable(usize, usize), | ||
InputOutputTristate(usize, usize, usize), | ||
InputOutputEnable(usize, usize, usize), | ||
} | ||
|
||
#[derive(Debug, Default)] | ||
pub struct BScanBuilder { | ||
pub bits: usize, | ||
} | ||
|
||
impl BScanBuilder { | ||
pub fn new() -> Self { | ||
Self { bits: 0 } | ||
} | ||
|
||
pub fn get_toi(&mut self) -> BScanPin { | ||
let res = BScanPin::InputOutputTristate(self.bits + 2, self.bits + 1, self.bits); | ||
self.bits += 3; | ||
res | ||
} | ||
|
||
pub fn get_to(&mut self) -> BScanPin { | ||
let res = BScanPin::OutputTristate(self.bits + 1, self.bits); | ||
self.bits += 2; | ||
res | ||
} | ||
|
||
pub fn get_o(&mut self) -> BScanPin { | ||
let res = BScanPin::Output(self.bits); | ||
self.bits += 1; | ||
res | ||
} | ||
|
||
pub fn get_i(&mut self) -> BScanPin { | ||
let res = BScanPin::Input(self.bits); | ||
self.bits += 1; | ||
res | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.