Repository: nexus-xyz/nexus-zkvm
File: vm/src/eval.rs (Rust)

Code before:
    /// Syscall implementation
    pub syscalls: Syscalls,
    /// current instruction
    pub inst: Inst,
    /// internal result register
    pub Z: u32,
    /// used instruction sets
    pub instruction_sets: HashSet<InstructionSet>,
    /// Machine memory.
    pub mem: M,
    /// Memory proof for current instruction at pc
    pub pc_proof: M::Proof,
    /// Memory proof for load/store instructions.
    pub read_proof: Option<M::Proof>,
    /// Memory proof for store instructions.
    pub write_proof: Option<M::Proof>,
    /// Number of executed instructions.
    pub trace_len: usize,
    /// Maximum (inclusive) number of instruction this VM instance is allowed to execute.
    ///
    /// Does include executing UNIMP instruction.
    pub max_trace_len: Option<usize>,

    /// Profiling cycles
    /// The global clk for execution trace.
    pub global_clk: u64,
    /// The cycles tracker label: (func_name, (global_clk, counter))
    pub cycle_tracker: HashMap<String, (u64, u32)>,
}

/// ISA defined registers
#[derive(
    Debug,
    Clone,
    PartialEq,
    Default,
    Serialize,
    Deserialize,
    CanonicalSerialize,
    CanonicalDeserialize,
)]
pub struct Regs {
    /// ISA defined program counter register
    pub pc: u32,
    /// ISA defined registers x0-x31
    pub x: [u32; 32],
}

impl<M: Memory> NexusVM<M> {
    pub fn new(pc: u32) -> Self {
        let mut vm = Self::default();

Review comment (suggestion):
This should maybe be like `cycle_count` or something, since instructions per clock cycle and the cycles needed for a specific instruction are not necessarily related 1-to-1 (yes the zkVM is at present single core and single threaded, but that could change). 

So we probably want to retain the notion of a clock as something distinct, in case we want to implement it more generally and thoroughly at some point.

Code after:
    /// Syscall implementation
    pub syscalls: Syscalls,
    /// current instruction
    pub inst: Inst,
    /// internal result register
    pub Z: u32,
    /// used instruction sets
    pub instruction_sets: HashSet<InstructionSet>,
    /// Machine memory.
    pub mem: M,
    /// Memory proof for current instruction at pc
    pub pc_proof: M::Proof,
    /// Memory proof for load/store instructions.
    pub read_proof: Option<M::Proof>,
    /// Memory proof for store instructions.
    pub write_proof: Option<M::Proof>,
    /// Number of executed instructions.
    pub trace_len: usize,
    /// Maximum (inclusive) number of instruction this VM instance is allowed to execute.
    ///
    /// Does include executing UNIMP instruction.
    pub max_trace_len: Option<usize>,

    /// The cycle count for execution trace.
    pub cycle_count: u64,
    /// The cycles tracker label: (func_name, (cycle_count, counter))
    pub cycle_tracker: HashMap<String, (u64, u32)>,
}

/// ISA defined registers
#[derive(
    Debug,
    Clone,
    PartialEq,
    Default,
    Serialize,
    Deserialize,
    CanonicalSerialize,
    CanonicalDeserialize,
)]
pub struct Regs {
    /// ISA defined program counter register
    pub pc: u32,
    /// ISA defined registers x0-x31
    pub x: [u32; 32],
}

impl<M: Memory> NexusVM<M> {
    pub fn new(pc: u32) -> Self {
        let mut vm = Self::default();