Skip to content

Commit

Permalink
Prog gen alive again
Browse files Browse the repository at this point in the history
  • Loading branch information
ginty committed Jul 25, 2024
1 parent fc5eb35 commit 4aa41db
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
5 changes: 2 additions & 3 deletions rust/origen/src/core/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ pub trait TesterAPI: std::fmt::Debug + Interceptor + TesterID + TesterAPIClone {
/// and not patgen and vice versa, in that case they will return an empty vector.
fn render_pattern(&mut self, ast: &Node<PAT>) -> crate::Result<Vec<PathBuf>> {
let _ = ast;
log_debug!("Tester '{}' does not implement render_pattern", &self.id());
log_error!("Tester '{}' does not implement render_pattern", &self.id());
Ok(vec![])
}

Expand All @@ -862,8 +862,7 @@ pub trait TesterAPI: std::fmt::Debug + Interceptor + TesterID + TesterAPIClone {
/// A default implementation is given since some testers may only support prog gen
/// and not patgen and vice versa, in that case they will return an empty vector.
fn render_program(&mut self) -> crate::Result<(Vec<PathBuf>, Model)> {
log_debug!("Tester '{}' does not implement render_program", &self.id());
Ok((vec![], Model::new(self.id_prog_gen())))
origen_metal::prog_gen::render_program(self.id_prog_gen(), &self.output_dir()?)
}

/// The tester should implement this to return a differ instance which is configured
Expand Down
8 changes: 1 addition & 7 deletions rust/origen/src/testers/smt/v93k/smt7/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
use crate::core::tester::{Interceptor, TesterAPI, TesterID};
use crate::core::tester::{Interceptor, TesterID};
use crate::generator::PAT;
use origen_metal::prog_gen::Model;
use crate::testers::vector_based::pattern_renderer::Renderer;
use crate::testers::vector_based::VectorBased;
use crate::testers::SupportedTester;
use origen_metal::prog_gen::SupportedTester as ProgGenSupportedTester;
use crate::{Result, DUT};
use origen_metal::ast::{Node, Return};
use std::path::PathBuf;

#[derive(Debug, Clone)]
pub struct SMT7 {}
Expand Down Expand Up @@ -100,10 +98,6 @@ impl VectorBased for SMT7 {
_ => None,
}
}

fn render_program(&mut self) -> crate::Result<(Vec<PathBuf>, Model)> {
origen_metal::prog_gen::advantest::smt7::render_test_program(&self.output_dir()?)
}
}

impl Interceptor for SMT7 {}
6 changes: 0 additions & 6 deletions rust/origen/src/testers/vector_based/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pub mod pattern_renderer;
use crate::core::model::pins::pin::Resolver;
use crate::core::tester::{TesterAPI, TesterID};
use crate::generator::PAT;
use origen_metal::prog_gen::Model;
use crate::{Overlay, Result};
use origen_metal::ast::{Node, Return};
use origen_metal::utils::differ::{ASCIIDiffer, Differ};
Expand Down Expand Up @@ -65,11 +64,6 @@ pub trait VectorBased:
label.as_ref().unwrap_or(&"".to_string())
)))
}

fn render_program(&mut self) -> crate::Result<(Vec<PathBuf>, Model)> {
log_debug!("Tester '{}' does not implement render_program", &self.id());
Ok((vec![], Model::new(self.id_prog_gen())))
}
}

impl<T: 'static> pattern_renderer::RendererAPI for T
Expand Down
2 changes: 1 addition & 1 deletion rust/origen_metal/src/prog_gen/advantest/smt7/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::io::Write;
use std::path::{Path, PathBuf};

/// Main entry point to render the current test program, paths to all files generated are returned
pub fn render_test_program(output_dir: &Path) -> Result<(Vec<PathBuf>, Model)> {
pub fn render(output_dir: &Path) -> Result<(Vec<PathBuf>, Model)> {
let mut files = vec![];

let testflow_dir = output_dir.join("testflow");
Expand Down
10 changes: 10 additions & 0 deletions rust/origen_metal/src/prog_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ mod validators;
pub mod config;
mod supported_testers;

use std::path::Path;
use std::path::PathBuf;

pub use flow_manager::FlowManager;
pub use model::Bin;
pub use model::BinType;
Expand Down Expand Up @@ -92,3 +95,10 @@ pub fn trace_error<T: Attrs>(node: &Node<T>, error: crate::Error) -> crate::Resu
};
bail!("{}\n{}", error, &help)
}

pub fn render_program(tester: SupportedTester, output_dir: &Path) -> crate::Result<(Vec<PathBuf>, Model)> {
match tester {
SupportedTester::V93KSMT7 => advantest::smt7::render(output_dir),
_ => unimplemented!("Tester {:?} is not yet supported for render_program", tester),
}
}

0 comments on commit 4aa41db

Please sign in to comment.