multi-core-inverter: test an alternate Vec-based stimulus

it's about 0.5% slower. not much.
This commit is contained in:
2022-08-18 04:11:56 -07:00
parent b9581b79b2
commit fb9d982545

View File

@@ -43,6 +43,7 @@ use coremem::cross::compound::list::{
Empty,
EnumerateU32,
Flatten as _,
IntoVec as _,
List1,
Map,
MapVisitor,
@@ -54,7 +55,7 @@ use coremem::meas;
use coremem::real::{self, Real as _};
use coremem::sim::spirv::{self, SpirvSim};
use coremem::sim::units::Seconds;
use coremem::stim::{CurlStimulus, Exp, Gated, Shifted};
use coremem::stim::{AbstractStimulus, CurlStimulus, DynStimuli, Exp, Gated, Shifted};
use coremem::Driver;
type R = real::R32;
@@ -98,6 +99,15 @@ where
}
}
struct MapIntoBoxStimulus;
impl<S: AbstractStimulus + 'static> MapVisitor<S> for MapIntoBoxStimulus {
type Output = Box<dyn AbstractStimulus>;
fn map(&self, s: S) -> Self::Output {
Box::new(s)
}
}
enum DriveDirection {
High,
Low,
@@ -372,6 +382,7 @@ fn main() {
let duration = Seconds(params.clock_phase_duration * (num_cycles + 3) as f32);
// let stim = DynStimuli::from_vec(stim.map(MapIntoBoxStimulus).into_vec());
let mut driver = driver.with_stimulus(stim);
let prefix = "out/applications/multi_core_inverter/19-4ns-1e7A/";