Merge "Enable WMMU."

GitOrigin-RevId: 634f6371e1b965d782534705c0c975abcdf94510
This commit is contained in:
Adam Jesionowski
2022-06-02 16:45:00 +00:00
committed by Sam Leffler
parent b8dfe92451
commit 20f1d1aa9d
4 changed files with 165 additions and 13 deletions

View File

@@ -3,15 +3,32 @@
use cstr_core::CString;
use kata_memory_interface::ObjDescBundle;
/// The Vector Core uses a Windowed MMU (go/sparrow-wmmu) in order to prevent
/// models from interferring with each other. Before executing a model,
/// windows to only that model's code and data are opened.
/// A window is represented by an address and size of that window.
pub struct Window {
pub addr: usize,
pub size: usize,
}
/// When a model is loaded onto the Vector Core, the ML Coordinator needs to
/// track where each window is.
pub struct ModelSections {
pub instructions: Window,
pub data: Window,
}
pub trait MlCoordinatorInterface {
fn execute(&mut self, bundle_id: &str, model_id: &str);
fn set_continuous_mode(&mut self, mode: bool);
}
pub trait MlCoreInterface {
fn set_wmmu(&mut self, sections: &ModelSections);
fn enable_interrupts(&mut self, enabled: bool);
fn run(&mut self);
fn load_image(&mut self, frames: &ObjDescBundle) -> Result<(), &'static str>;
fn load_image(&mut self, frames: &ObjDescBundle) -> Result<ModelSections, &'static str>;
fn get_return_code() -> u32;
fn get_fault_register() -> u32;
fn clear_host_req();