forked from libre-chip/cpu
		
	add Serialize/Deserialize impls for CpuConfig
This commit is contained in:
		
							parent
							
								
									49d13648ec
								
							
						
					
					
						commit
						6b703b012a
					
				
					 5 changed files with 8 additions and 3 deletions
				
			
		
							
								
								
									
										1
									
								
								Cargo.lock
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										1
									
								
								Cargo.lock
									
										
									
										generated
									
									
									
								
							| 
						 | 
					@ -210,6 +210,7 @@ name = "cpu"
 | 
				
			||||||
version = "0.1.0"
 | 
					version = "0.1.0"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "fayalite",
 | 
					 "fayalite",
 | 
				
			||||||
 | 
					 "serde",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,6 +15,7 @@ rust-version = "1.89.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[workspace.dependencies]
 | 
					[workspace.dependencies]
 | 
				
			||||||
fayalite = { git = "https://git.libre-chip.org/libre-chip/fayalite.git", version = "0.3.0", branch = "master" }
 | 
					fayalite = { git = "https://git.libre-chip.org/libre-chip/fayalite.git", version = "0.3.0", branch = "master" }
 | 
				
			||||||
 | 
					serde = { version = "1.0.202", features = ["derive"] }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[profile.dev]
 | 
					[profile.dev]
 | 
				
			||||||
opt-level = 1
 | 
					opt-level = 1
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,3 +16,4 @@ version.workspace = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[dependencies]
 | 
					[dependencies]
 | 
				
			||||||
fayalite.workspace = true
 | 
					fayalite.workspace = true
 | 
				
			||||||
 | 
					serde.workspace = true
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,9 +8,10 @@ use crate::{
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
use fayalite::prelude::*;
 | 
					use fayalite::prelude::*;
 | 
				
			||||||
 | 
					use serde::{Deserialize, Serialize};
 | 
				
			||||||
use std::num::NonZeroUsize;
 | 
					use std::num::NonZeroUsize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
 | 
					#[derive(Clone, Eq, PartialEq, Hash, Debug, Serialize, Deserialize)]
 | 
				
			||||||
#[non_exhaustive]
 | 
					#[non_exhaustive]
 | 
				
			||||||
pub struct UnitConfig {
 | 
					pub struct UnitConfig {
 | 
				
			||||||
    pub kind: UnitKind,
 | 
					    pub kind: UnitKind,
 | 
				
			||||||
| 
						 | 
					@ -27,7 +28,7 @@ impl UnitConfig {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
 | 
					#[derive(Clone, Eq, PartialEq, Hash, Debug, Serialize, Deserialize)]
 | 
				
			||||||
#[non_exhaustive]
 | 
					#[non_exhaustive]
 | 
				
			||||||
pub struct CpuConfig {
 | 
					pub struct CpuConfig {
 | 
				
			||||||
    pub units: Vec<UnitConfig>,
 | 
					    pub units: Vec<UnitConfig>,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,6 +15,7 @@ use fayalite::{
 | 
				
			||||||
    intern::{Intern, Interned},
 | 
					    intern::{Intern, Interned},
 | 
				
			||||||
    prelude::*,
 | 
					    prelude::*,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					use serde::{Deserialize, Serialize};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub mod alu_branch;
 | 
					pub mod alu_branch;
 | 
				
			||||||
pub mod unit_base;
 | 
					pub mod unit_base;
 | 
				
			||||||
| 
						 | 
					@ -36,7 +37,7 @@ macro_rules! all_units {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    ) => {
 | 
					    ) => {
 | 
				
			||||||
        $(#[$enum_meta])*
 | 
					        $(#[$enum_meta])*
 | 
				
			||||||
        #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug)]
 | 
					        #[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Serialize, Deserialize)]
 | 
				
			||||||
        $vis enum $UnitKind {
 | 
					        $vis enum $UnitKind {
 | 
				
			||||||
            $(
 | 
					            $(
 | 
				
			||||||
                $(#[$variant_meta])*
 | 
					                $(#[$variant_meta])*
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue