reformat, only set mode for gal16v8

This commit is contained in:
saji 2024-05-05 01:41:26 -05:00
parent 336ed900f4
commit d3c498231e
2 changed files with 23 additions and 16 deletions

View file

@ -26,7 +26,7 @@ pub enum MappingError {
SopTooBig { SopTooBig {
name: String, name: String,
sop_size: usize, sop_size: usize,
wanted_size: usize wanted_size: usize,
}, },
#[error("Unknown error")] #[error("Unknown error")]
@ -97,8 +97,12 @@ fn map_remaining_olmc(
} }
None => { None => {
let minsize = unused.iter().map(|x| x.1).min().unwrap(); let minsize = unused.iter().map(|x| x.1).min().unwrap();
Err(MappingError::SopTooBig {name: sop.name.unwrap(), sop_size: sopsize, wanted_size: minsize}) Err(MappingError::SopTooBig {
}, name: sop.name.unwrap(),
sop_size: sopsize,
wanted_size: minsize,
})
}
} }
} }
@ -307,7 +311,11 @@ pub fn graph_convert(graph: &Graph, pcf: PcfFile, chip: Chip) -> anyhow::Result<
let rowsize = chip.num_rows_for_olmc(olmc_row); let rowsize = chip.num_rows_for_olmc(olmc_row);
if sopsize > rowsize { if sopsize > rowsize {
return Err(MappingError::SopTooBig { return Err(MappingError::SopTooBig {
name: sop.name.unwrap(), sop_size: sopsize, wanted_size: rowsize }.into()); name: sop.name.unwrap(),
sop_size: sopsize,
wanted_size: rowsize,
}
.into());
} }
info!("Found a real pin to map: Mapping node {o:?} onto row {olmc_row}"); info!("Found a real pin to map: Mapping node {o:?} onto row {olmc_row}");
@ -377,13 +385,12 @@ pub fn graph_convert(graph: &Graph, pcf: PcfFile, chip: Chip) -> anyhow::Result<
let tri_sop = get_sop_for_olmc(graph, node, "E")?; let tri_sop = get_sop_for_olmc(graph, node, "E")?;
debug!("Sop found, {:?}", tri_sop); debug!("Sop found, {:?}", tri_sop);
assert_eq!(tri_sop.parameters.depth, 1); assert_eq!(tri_sop.parameters.depth, 1);
let tri_term = make_term_from_sop(graph, &pcf, &olmcmap, &chip, tri_sop); let tri_term =
make_term_from_sop(graph, &pcf, &olmcmap, &chip, tri_sop);
debug!("Term for tristate SOP made = {:?}", tri_term); debug!("Term for tristate SOP made = {:?}", tri_term);
tri_term tri_term
} }
Net::LiteralOne => { Net::LiteralOne => true_term(0),
true_term(0)
}
Net::LiteralZero => { Net::LiteralZero => {
warn!("Making a false term for output enable, this shouldn't happen!"); warn!("Making a false term for output enable, this shouldn't happen!");
false_term(0) false_term(0)
@ -393,7 +400,6 @@ pub fn graph_convert(graph: &Graph, pcf: PcfFile, chip: Chip) -> anyhow::Result<
} }
}; };
let outpin = Pin { let outpin = Pin {
pin: 0, // PIN VALUE IS DISCARDED FOR THIS CALL pin: 0, // PIN VALUE IS DISCARDED FOR THIS CALL
neg: o.parameters.inverted, neg: o.parameters.inverted,
@ -409,12 +415,11 @@ pub fn graph_convert(graph: &Graph, pcf: PcfFile, chip: Chip) -> anyhow::Result<
"Setting base for olmc outpin: {:?}, pinmode: {:?}", "Setting base for olmc outpin: {:?}, pinmode: {:?}",
outpin, pinmode outpin, pinmode
); );
bp.olmcs[idx].set_base(&outpin, term, pinmode).ok_or(MappingError::Unknown)?; bp.olmcs[idx]
let dummy_pin = Pin { .set_base(&outpin, term, pinmode)
pin: 0, neg: false .ok_or(MappingError::Unknown)?;
}; let dummy_pin = Pin { pin: 0, neg: false };
bp.olmcs[idx].set_enable(&dummy_pin, tri_term)?; bp.olmcs[idx].set_enable(&dummy_pin, tri_term)?;
} else { } else {
panic!("screaming"); panic!("screaming");
} }

View file

@ -105,7 +105,9 @@ fn synth(s: SynthArgs) -> Result<()> {
let mut gal = build(&res)?; let mut gal = build(&res)?;
if matches!(s.chip, ChipType::GAL16V8) {
gal.set_mode(galette::gal::Mode::Registered); gal.set_mode(galette::gal::Mode::Registered);
}
let config = Config { let config = Config {
gen_pin: false, gen_pin: false,