mirror of
https://gitlab.cern.ch/wotsubo/endcap-sl-software-ri-generator.git
synced 2025-04-09 23:26:54 +09:00
update(docs): add docs on validator
This commit is contained in:
parent
cba5b8594b
commit
ccfd443e5d
3 changed files with 7 additions and 1 deletions
|
@ -14,7 +14,8 @@
|
|||
//!
|
||||
//! 1. Convert [`roxmltree::Document`] to register map represented with types defined in
|
||||
//! [`types`], filling missing parameters. See [`converter`].
|
||||
//! 2. Generate [`proc_macro2::TokenStream`] from register map produced in the previous step. See
|
||||
//! 2. Validate the register map. See [`types::Module::validate`] in [`validator`].
|
||||
//! 3. Generate [`proc_macro2::TokenStream`] from register map produced in the previous step. See
|
||||
//! [`generator`].
|
||||
//!
|
||||
//! # modules
|
||||
|
@ -22,6 +23,7 @@
|
|||
//! - [`converter`]: DOM to internal representation
|
||||
//! - [`generator`]: internal representation to rust code
|
||||
//! - [`io`]: formatting and printing
|
||||
//! - [`validator`]: validate the register map and generate flattened register map
|
||||
|
||||
pub mod converter;
|
||||
pub mod generator;
|
||||
|
|
|
@ -16,6 +16,8 @@ struct Args {
|
|||
#[derive(Debug, Subcommand)]
|
||||
enum Commands {
|
||||
/// Generate register interface code.
|
||||
///
|
||||
/// Also run validation before generation.
|
||||
Generate {
|
||||
/// Output directory.
|
||||
out: path::PathBuf,
|
||||
|
|
|
@ -20,6 +20,8 @@ type FlattenedRegisterMap<'a> = Vec<Option<FlattenedRegisterEntry<'a>>>;
|
|||
|
||||
impl Module {
|
||||
/// Validate the address assignment, generating a flatten register map.
|
||||
/// Returns a tuple of [`FlattenedRegisterMap`] and [`ValidationError`]s vector.
|
||||
/// Empty errors vector means there is no errors in the register map.
|
||||
pub fn validate(&self) -> (FlattenedRegisterMap, Vec<ValidationError>) {
|
||||
let mut mapping = Vec::new();
|
||||
mapping.resize(self.size.try_into().unwrap(), None);
|
||||
|
|
Loading…
Reference in a new issue