forked from M-Labs/nac3
nac3artiq: refactor timeline functions
This commit is contained in:
parent
c5e731f16d
commit
c429a86586
|
@ -163,19 +163,11 @@ impl Nac3 {
|
|||
}
|
||||
}
|
||||
|
||||
#[pymethods]
|
||||
impl Nac3 {
|
||||
#[new]
|
||||
fn new(isa: &str) -> PyResult<Self> {
|
||||
let isa = match isa {
|
||||
"riscv" => Isa::RiscV,
|
||||
"cortexa9" => Isa::CortexA9,
|
||||
_ => return Err(exceptions::PyValueError::new_err("invalid ISA")),
|
||||
};
|
||||
let primitive: PrimitiveStore = TopLevelComposer::make_primitives().0;
|
||||
let mut builtins = vec![];
|
||||
if isa == Isa::RiscV {
|
||||
builtins.push((
|
||||
// ARTIQ timeline control with now-pinning optimization.
|
||||
// This is a bit of mess due to endianness issues.
|
||||
// Modify gateware to make `now` little-endian, since we don't have OpenRISC anymore?
|
||||
fn timeline_builtins(primitive: &PrimitiveStore) -> Vec<(StrRef, FunSignature, Arc<GenCall>)> {
|
||||
vec![(
|
||||
"now_mu".into(),
|
||||
FunSignature {
|
||||
args: vec![],
|
||||
|
@ -197,8 +189,7 @@ impl Nac3 {
|
|||
}
|
||||
}
|
||||
)))
|
||||
));
|
||||
builtins.push((
|
||||
),(
|
||||
"at_mu".into(),
|
||||
FunSignature {
|
||||
args: vec![FuncArg {
|
||||
|
@ -232,8 +223,7 @@ impl Nac3 {
|
|||
}
|
||||
}
|
||||
)))
|
||||
));
|
||||
builtins.push((
|
||||
),(
|
||||
"delay_mu".into(),
|
||||
FunSignature {
|
||||
args: vec![FuncArg {
|
||||
|
@ -272,8 +262,20 @@ impl Nac3 {
|
|||
}
|
||||
}
|
||||
)))
|
||||
));
|
||||
}
|
||||
)]
|
||||
}
|
||||
|
||||
#[pymethods]
|
||||
impl Nac3 {
|
||||
#[new]
|
||||
fn new(isa: &str) -> PyResult<Self> {
|
||||
let isa = match isa {
|
||||
"riscv" => Isa::RiscV,
|
||||
"cortexa9" => Isa::CortexA9,
|
||||
_ => return Err(exceptions::PyValueError::new_err("invalid ISA")),
|
||||
};
|
||||
let primitive: PrimitiveStore = TopLevelComposer::make_primitives().0;
|
||||
let builtins = if isa == Isa::RiscV { timeline_builtins(&primitive) } else { vec![] };
|
||||
let (composer, builtins_def, builtins_ty) = TopLevelComposer::new(builtins);
|
||||
Ok(Nac3 {
|
||||
isa,
|
||||
|
|
Loading…
Reference in New Issue