Skip to content

Commit

Permalink
ise_hammer: 2v/3s BRAM.
Browse files Browse the repository at this point in the history
  • Loading branch information
wanda-phi committed May 18, 2024
1 parent a565700 commit c257698
Show file tree
Hide file tree
Showing 7 changed files with 416 additions and 5 deletions.
15 changes: 15 additions & 0 deletions prjcombine_ise_hammer/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ impl<'a> From<bool> for Value<'a> {
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
pub enum MultiValue {
Lut,
Hex,
}

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -329,6 +330,20 @@ impl<'a> Backend for IseBackend<'a> {
}
Value::String(v.into())
}
MultiValue::Hex => {
let mut v = String::new();
let nc = y.len() / 4;
for i in 0..nc {
let mut c = 0;
for j in 0..4 {
if y[(nc - 1 - i) * 4 + j] {
c |= 1 << j;
}
}
write!(v, "{c:x}").unwrap();
}
Value::String(v.into())
}
}
}
}
Loading

0 comments on commit c257698

Please sign in to comment.