-
Notifications
You must be signed in to change notification settings - Fork 651
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
earlgrey/ot: document configurations
No explicit default copy.
- Loading branch information
Showing
5 changed files
with
56 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,42 @@ | ||
//! Chip specific configuration. | ||
//! | ||
//! This file includes configuration values for different implementations and | ||
//! uses of the same earlgrey chip. For example, running the chip on an FPGA | ||
//! requires different parameters from running it in a verilog simulator. | ||
//! Additionally, chips on different platforms can be used differently, so this | ||
//! also permits changing values like the UART baud rate to enable better | ||
//! debugging on platforms that can support it. | ||
//! | ||
//! The configuration used is selected via Cargo features specified when the | ||
//! board is compiled. | ||
|
||
// Chip configuration based on the target device. | ||
/// Earlgrey configuration based on the target device. | ||
pub struct Config<'a> { | ||
/// Identifier for the platform. This is useful for debugging to confirm the | ||
/// correct configuration of the chip is being used. | ||
pub name: &'a str, | ||
/// The clock speed of the core in Hz. | ||
pub chip_freq: u32, | ||
/// The baud rate for UART. This allows for a version of the chip that can | ||
/// support a faster baud rate to use it to help with debugging. | ||
pub uart_baudrate: u32, | ||
} | ||
|
||
#[cfg(not(feature = "config_disable_default"))] | ||
/// Config for running EarlGrey on an FPGA. Also the default configuration. | ||
#[cfg(any( | ||
feature = "config_fpga_nexysvideo", | ||
not(feature = "config_disable_default") | ||
))] | ||
pub const CONFIG: Config = Config { | ||
name: &"default", | ||
chip_freq: 50_000_000, | ||
uart_baudrate: 230400, | ||
}; | ||
|
||
#[cfg(feature = "config_fpga_nexysvideo")] | ||
pub const CONFIG: Config = Config { | ||
name: &"fpga_nexysvideo", | ||
name: "fpga_nexysvideo", | ||
chip_freq: 50_000_000, | ||
uart_baudrate: 230400, | ||
}; | ||
|
||
/// Config for running EarlGrey in a verilog simulator. | ||
#[cfg(feature = "config_sim_verilator")] | ||
pub const CONFIG: Config = Config { | ||
name: &"sim_verilator", | ||
name: "sim_verilator", | ||
chip_freq: 500_000, | ||
uart_baudrate: 9600, | ||
}; |