forked from libre-chip/cpu
		
	add Serialize/Deserialize impls for CpuConfig
This commit is contained in:
		
							parent
							
								
									2c5b1b7f44
								
							
						
					
					
						commit
						f728964cb3
					
				
					 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"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "fayalite",
 | 
			
		||||
 "serde",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,6 +15,7 @@ rust-version = "1.89.0"
 | 
			
		|||
 | 
			
		||||
[workspace.dependencies]
 | 
			
		||||
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]
 | 
			
		||||
opt-level = 1
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -16,3 +16,4 @@ version.workspace = true
 | 
			
		|||
 | 
			
		||||
[dependencies]
 | 
			
		||||
fayalite.workspace = true
 | 
			
		||||
serde.workspace = true
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,9 +8,10 @@ use crate::{
 | 
			
		|||
    },
 | 
			
		||||
};
 | 
			
		||||
use fayalite::prelude::*;
 | 
			
		||||
use serde::{Deserialize, Serialize};
 | 
			
		||||
use std::num::NonZeroUsize;
 | 
			
		||||
 | 
			
		||||
#[derive(Clone, Eq, PartialEq, Hash, Debug)]
 | 
			
		||||
#[derive(Clone, Eq, PartialEq, Hash, Debug, Serialize, Deserialize)]
 | 
			
		||||
#[non_exhaustive]
 | 
			
		||||
pub struct UnitConfig {
 | 
			
		||||
    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]
 | 
			
		||||
pub struct CpuConfig {
 | 
			
		||||
    pub units: Vec<UnitConfig>,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,6 +15,7 @@ use fayalite::{
 | 
			
		|||
    intern::{Intern, Interned},
 | 
			
		||||
    prelude::*,
 | 
			
		||||
};
 | 
			
		||||
use serde::{Deserialize, Serialize};
 | 
			
		||||
 | 
			
		||||
pub mod alu_branch;
 | 
			
		||||
pub mod unit_base;
 | 
			
		||||
| 
						 | 
				
			
			@ -36,7 +37,7 @@ macro_rules! all_units {
 | 
			
		|||
        }
 | 
			
		||||
    ) => {
 | 
			
		||||
        $(#[$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 {
 | 
			
		||||
            $(
 | 
			
		||||
                $(#[$variant_meta])*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue