Skip to content

Commit

Permalink
Can fully compile O2 and run prog gen (but it doesn't get far)
Browse files Browse the repository at this point in the history
  • Loading branch information
ginty committed Jul 24, 2024
1 parent d90631f commit fc5eb35
Show file tree
Hide file tree
Showing 18 changed files with 247 additions and 61 deletions.
20 changes: 12 additions & 8 deletions rust/origen/src/core/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,12 @@ impl Tester {
let pat_ref_id = TEST.push_and_open(n.clone());
let prog_ref_id;
if FLOW.is_open() {
// MUSTDO: Handle this for prog gen
//let n = node!(PGM::TesterEq, testers.clone());
//prog_ref_id = FLOW.push_and_open(n)?;
prog_ref_id = 0;
let mut prog_gen_testers = vec![];
for t in &testers {
prog_gen_testers.push(t.prog_gen_supported_tester()?);
}
let n = node!(PGM::TesterEq, prog_gen_testers);
prog_ref_id = FLOW.push_and_open(n)?;
} else {
prog_ref_id = 0;
}
Expand Down Expand Up @@ -201,10 +203,12 @@ impl Tester {
let pat_ref_id = TEST.push_and_open(n.clone());
let prog_ref_id;
if FLOW.is_open() {
// MUSTDO: Handle this for prog gen
//let n = node!(PGM::TesterNeq, testers.clone());
//prog_ref_id = FLOW.push_and_open(n)?;
prog_ref_id = 0;
let mut prog_gen_testers = vec![];
for t in &testers {
prog_gen_testers.push(t.prog_gen_supported_tester()?);
}
let n = node!(PGM::TesterNeq, prog_gen_testers);
prog_ref_id = FLOW.push_and_open(n)?;
} else {
prog_ref_id = 0;
}
Expand Down
15 changes: 15 additions & 0 deletions rust/origen/src/testers/supported_testers.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::Result as OrigenResult;
use std::fmt;
use std::str::FromStr;
use origen_metal::prog_gen::SupportedTester as ProgGenSupportedTester;

#[derive(Debug, PartialEq, Clone, Eq, Hash, Serialize)]
pub enum SupportedTester {
Expand Down Expand Up @@ -48,6 +49,20 @@ impl SupportedTester {
}
s
}

pub fn prog_gen_supported_tester(&self) -> OrigenResult<ProgGenSupportedTester> {
match self {
SupportedTester::ALL => Ok(ProgGenSupportedTester::ALL),
SupportedTester::V93K => Ok(ProgGenSupportedTester::V93K),
SupportedTester::V93KSMT7 => Ok(ProgGenSupportedTester::V93KSMT7),
SupportedTester::V93KSMT8 => Ok(ProgGenSupportedTester::V93KSMT8),
SupportedTester::IGXL => Ok(ProgGenSupportedTester::IGXL),
SupportedTester::J750 => Ok(ProgGenSupportedTester::J750),
SupportedTester::ULTRAFLEX => Ok(ProgGenSupportedTester::ULTRAFLEX),
SupportedTester::SIMULATOR => Ok(ProgGenSupportedTester::SIMULATOR),
_ => bail!("No equivalent prog gen tester exists for {:?}", self),
}
}

pub fn new(name: &str) -> OrigenResult<Self> {
match SupportedTester::from_str(name) {
Expand Down
3 changes: 2 additions & 1 deletion rust/pyapi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ mod plugins;
use crate::registers::bit_collection::BitCollection;
use num_bigint::BigUint;
use om::lazy_static::lazy_static;
use origen::{Dut, Error, Operation, Result, Value, FLOW, ORIGEN_CONFIG, STATUS, TEST, clean_target};
use origen::{Dut, Error, Operation, Result, Value, ORIGEN_CONFIG, STATUS, TEST, clean_target};
use origen_metal::FLOW;
use origen_metal as om;
use pyapi_metal::{runtime_error, pypath};
use pyo3::conversion::AsPyPointer;
Expand Down
2 changes: 1 addition & 1 deletion rust/pyapi/src/prog_gen/condition.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::utility::caller::src_caller_meta;
use origen::prog_gen::{flow_api, FlowCondition};
use origen_metal::prog_gen::{flow_api, FlowCondition};
use pyo3::prelude::*;
use pyo3::types::{PyAny, PyType};

Expand Down
2 changes: 1 addition & 1 deletion rust/pyapi/src/prog_gen/flow_options.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Functions concerned with extracting known values from kwargs
use crate::utility::caller::src_caller_meta;
use origen::prog_gen::{flow_api, FlowCondition, FlowID};
use origen_metal::prog_gen::{flow_api, FlowCondition, FlowID};
use origen::Result;
use pyo3::types::PyDict;

Expand Down
4 changes: 2 additions & 2 deletions rust/pyapi/src/prog_gen/group.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use origen::prog_gen::{flow_api, FlowID, GroupType};
use origen::testers::SupportedTester;
use origen_metal::prog_gen::{flow_api, FlowID, GroupType};
use origen_metal::prog_gen::SupportedTester;
use pyo3::prelude::*;
use pyo3::types::{PyAny, PyType};

Expand Down
3 changes: 1 addition & 2 deletions rust/pyapi/src/prog_gen/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use super::flow_options;
use crate::prog_gen::{Condition, Group, Resources, Test, TestInvocation};
use crate::tester_apis::IGXL;
use crate::utility::caller::src_caller_meta;
use origen::prog_gen::{flow_api, BinType, FlowCondition, FlowID, GroupType, ResourcesType};
use origen::testers::SupportedTester;
use origen_metal::prog_gen::{flow_api, BinType, FlowCondition, FlowID, GroupType, ResourcesType, SupportedTester};
use origen::Result;
use pyo3::exceptions::PyTypeError;
use pyo3::prelude::*;
Expand Down
13 changes: 7 additions & 6 deletions rust/pyapi/src/prog_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ mod test_invocation;
pub use condition::Condition;
pub use group::Group;
use origen::core::tester::TesterSource;
use origen::prog_gen::{flow_api, FlowCondition, Model, ParamType, ParamValue};
use origen::testers::SupportedTester;
use origen::{Error, Result, FLOW};
use origen_metal::prog_gen::{flow_api, FlowCondition, Model, ParamType, ParamValue};
use origen_metal::FLOW;
use origen_metal::prog_gen::SupportedTester;
use origen::{Error, Result};
pub use pattern_group::PatternGroup;
use pyo3::prelude::*;
use pyo3::types::PyAny;
Expand Down Expand Up @@ -104,8 +105,8 @@ fn render(py: Python) -> PyResult<Vec<String>> {
thread::spawn(move || {
match t {
TesterSource::External(g) => {
log_error!("Python based tester targets are not supported for program generation yet, no action taken for target: {}", g);
Ok((vec![], Model::new(g)))
bail!("Python based tester targets are not supported for program generation yet, no action taken for target: {}", g);
//Ok((vec![], Model::new(g)))
}
TesterSource::Internal(t) => {
let mut tester = origen::tester();
Expand All @@ -116,7 +117,7 @@ fn render(py: Python) -> PyResult<Vec<String>> {
if continue_on_fail {
origen::STATUS.inc_unhandled_error_count();
log_error!("{}", &msg);
Ok((vec![], Model::new(t.id())))
Ok((vec![], Model::new(t.id_prog_gen())))
} else {
Err(e)
}
Expand Down
3 changes: 1 addition & 2 deletions rust/pyapi/src/prog_gen/pattern_group.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::utility::caller::src_caller_meta;
use origen::prog_gen::{flow_api, PatternGroupType};
use origen::testers::SupportedTester;
use origen_metal::prog_gen::{flow_api, PatternGroupType, SupportedTester};
use origen::Result;
use pyo3::prelude::*;

Expand Down
2 changes: 1 addition & 1 deletion rust/pyapi/src/prog_gen/resources.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::utility::caller::src_caller_meta;
use origen::prog_gen::flow_api;
use origen_metal::prog_gen::flow_api;
use pyo3::prelude::*;
use pyo3::types::{PyAny, PyType};

Expand Down
7 changes: 3 additions & 4 deletions rust/pyapi/src/prog_gen/test.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use super::to_param_value;
use crate::prog_gen::flow_options;
use crate::utility::caller::src_caller_meta;
use origen::prog_gen::{flow_api, Limit, LimitSelector, ParamValue};
use origen::testers::SupportedTester;
use origen_metal::prog_gen::{flow_api, Limit, LimitSelector, ParamValue, SupportedTester};
use origen::Result;
use pyo3::prelude::*;
use pyo3::types::PyDict;
Expand Down Expand Up @@ -71,7 +70,7 @@ impl Test {
let value = match to_param_value(value)? {
None => None,
Some(x) => Some(Limit {
kind: origen::prog_gen::LimitType::GTE,
kind: origen_metal::prog_gen::LimitType::GTE,
value: x,
unit: None,
}),
Expand All @@ -91,7 +90,7 @@ impl Test {
let value = match to_param_value(value)? {
None => None,
Some(x) => Some(Limit {
kind: origen::prog_gen::LimitType::LTE,
kind: origen_metal::prog_gen::LimitType::LTE,
value: x,
unit: None,
}),
Expand Down
7 changes: 3 additions & 4 deletions rust/pyapi/src/prog_gen/test_invocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ use super::to_param_value;
use super::Test;
use crate::prog_gen::flow_options;
use crate::utility::caller::src_caller_meta;
use origen::prog_gen::{flow_api, Limit, LimitSelector, ParamValue};
use origen::testers::SupportedTester;
use origen_metal::prog_gen::{flow_api, Limit, LimitSelector, ParamValue, SupportedTester};
use origen::Result;
use pyo3::exceptions::PyAttributeError;
use pyo3::prelude::*;
Expand Down Expand Up @@ -38,7 +37,7 @@ impl TestInvocation {
let value = match to_param_value(value)? {
None => None,
Some(x) => Some(Limit {
kind: origen::prog_gen::LimitType::GTE,
kind: origen_metal::prog_gen::LimitType::GTE,
value: x,
unit: None,
}),
Expand All @@ -58,7 +57,7 @@ impl TestInvocation {
let value = match to_param_value(value)? {
None => None,
Some(x) => Some(Limit {
kind: origen::prog_gen::LimitType::LTE,
kind: origen_metal::prog_gen::LimitType::LTE,
value: x,
unit: None,
}),
Expand Down
4 changes: 2 additions & 2 deletions rust/pyapi/src/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl PyTester {
#[getter]
fn ast(&self) -> PyResult<()> {
if Operation::GenerateFlow == STATUS.operation() {
println!("{}", origen::FLOW.to_string());
println!("{}", origen_metal::FLOW.to_string());
} else {
println!("{}", origen::TEST.to_string());
}
Expand All @@ -89,7 +89,7 @@ impl PyTester {
fn ast_to_file(&self, file: &str) -> PyResult<()> {
let contents = {
if Operation::GenerateFlow == STATUS.operation() {
origen::FLOW.to_string()
origen_metal::FLOW.to_string()
} else {
origen::TEST.to_string()
}
Expand Down
2 changes: 1 addition & 1 deletion rust/pyapi/src/tester_apis/igxl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ impl IGXL {
#[new]
pub fn new(tester: Option<String>) -> PyResult<Self> {
Ok(IGXL {
tester: match tester {
tester: match &tester {
None => SupportedTester::IGXL,
Some(t) => {
let t = t.to_uppercase().replace("_", "");
Expand Down
11 changes: 5 additions & 6 deletions rust/pyapi/src/tester_apis/igxl/prog_gen_api.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use super::IGXL;
use crate::prog_gen::{Group, PatternGroup, Test, TestInvocation};
use crate::utility::caller::src_caller_meta;
use origen::prog_gen::{flow_api, GroupType, ParamValue, PatternGroupType};
use origen::testers::SupportedTester;
use origen_metal::prog_gen::{flow_api, GroupType, ParamValue, PatternGroupType, SupportedTester};
use origen::{Error, Result};
use pyo3::prelude::*;
use pyo3::types::{PyDict, PyTuple};
Expand Down Expand Up @@ -32,7 +31,7 @@ impl IGXL {

let t = Test::new(
name.clone(),
self.tester.to_owned(),
self.tester.prog_gen_supported_tester()?,
library,
template,
kwargs,
Expand All @@ -45,7 +44,7 @@ impl IGXL {

#[pyo3(signature=(**kwargs))]
pub fn new_flow_line(&mut self, kwargs: Option<&PyDict>) -> PyResult<TestInvocation> {
let t = TestInvocation::new("_".to_owned(), self.tester.to_owned(), kwargs)?;
let t = TestInvocation::new("_".to_owned(), self.tester.prog_gen_supported_tester()?, kwargs)?;
Ok(t)
}

Expand All @@ -56,7 +55,7 @@ impl IGXL {
pattern: Option<&PyAny>,
patterns: Option<&PyAny>,
) -> PyResult<PatternGroup> {
let pg = PatternGroup::new(name, self.tester.clone(), Some(PatternGroupType::Patset))?;
let pg = PatternGroup::new(name, self.tester.prog_gen_supported_tester()?, Some(PatternGroupType::Patset))?;
if let Some(p) = pattern {
for pat in extract_vec_string("pattern", p)? {
pg.append(pat, None)?;
Expand Down Expand Up @@ -97,7 +96,7 @@ impl IGXL {
}

fn test_instance_group(&mut self, name: String) -> PyResult<Group> {
let g = Group::new(name, Some(self.tester.to_owned()), GroupType::Test, None);
let g = Group::new(name, Some(self.tester.prog_gen_supported_tester()?), GroupType::Test, None);
Ok(g)
}
}
Expand Down
2 changes: 1 addition & 1 deletion rust/pyapi/src/tester_apis/v93k/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod prog_gen_api;

use origen::testers::SupportedTester;
use origen_metal::prog_gen::SupportedTester;
use pyo3::exceptions;
use pyo3::prelude::*;

Expand Down
2 changes: 1 addition & 1 deletion rust/pyapi/src/tester_apis/v93k/prog_gen_api.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::V93K;
use crate::prog_gen::{Test, TestInvocation};
use origen::prog_gen::ParamValue;
use origen_metal::prog_gen::ParamValue;
use pyo3::prelude::*;
use pyo3::types::PyDict;

Expand Down
Loading

0 comments on commit fc5eb35

Please sign in to comment.