Skip to main content
← PSoXide SDK guides and examples · SDK f2fec1c301f1 · All Cargo features enabled; check feature gates before use.

Gte

Struct Gte 

Source
pub struct Gte { /* private fields */ }
Expand description

Full GTE state. Field grouping matches the PSX register map: vectors / FIFOs / accumulators in data-prefixed fields, matrices and translations in ctrl-prefixed fields. The MFC2/MTC2 paths pack and unpack these into 32-bit views.

Implementations§

Source§

impl Gte

Source

pub fn command_cycles(instr: u32) -> u32

Real-hardware cycle latency of the GTE command encoded in instr (the bottom six bits select the function), or 0 for encodings that decode as nops. Lets a CPU model charge the latency it stalls on when a GTE result register is read before the op completes.

Source

pub fn new() -> Self

Construct a freshly-reset GTE – all registers cleared. Real hardware powers on with garbage, but the BIOS zeroes the lot before first use, so we save a redundant write by starting clean.

Source

pub fn profile_snapshot(&self) -> GteProfileSnapshot

Current monotonic GTE diagnostic counters.

Source

pub fn read_data(&self, idx: u8) -> u32

MFC2 view of data register idx. Mirrors what the CPU sees on mfc2 rt, $rd.

Source

pub fn write_data(&mut self, idx: u8, value: u32)

MTC2 view of data register idx.

Source

pub fn read_control(&self, idx: u8) -> u32

CFC2 view of control register idx.

Source

pub fn write_control(&mut self, idx: u8, value: u32)

CTC2 view of control register idx.

Source

pub fn execute_with_stale_v0x(&mut self, instr: u32, stale_x: i16)

Execute one COP2 function with the HWB-010 MTC2-commit hazard injected: the first transform row reading V0 sees stale_x as V0.x (the value held before the in-flight MTC2 VXY0 write), while later rows see the fresh register. Silicon-measured: six exact arithmetic confirmations across two live hardware captures, HWB-009 and HWB-010.

Source

pub fn execute_op_with_stale_ir3(&mut self, instr: u32, stale_ir3: i16)

Execute OP with an MTC2 IR3 value still committing during its first sequential MAC row. MAC1 sees stale_ir3; MAC2/MAC3 see current IR3.

Source

pub fn execute(&mut self, instr: u32)

Execute one COP2 function. instr is the full 32-bit instruction word so we can pull sf/lm/mx/vx/cv. Unrecognised commands return without updating state – real hardware decodes them as nops, which matches what we observe in PCSX-Redux’s interpreter.

Trait Implementations§

Source§

impl Default for Gte

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Gte

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Gte

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Gte

§

impl RefUnwindSafe for Gte

§

impl Send for Gte

§

impl Sync for Gte

§

impl Unpin for Gte

§

impl UnsafeUnpin for Gte

§

impl UnwindSafe for Gte

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,