Skip to content

Commit

Permalink
Merge pull request #85 from 0xPolygonHermez/sam-op-macro
Browse files Browse the repository at this point in the history
completely re-work ops
  • Loading branch information
sam0x17 authored Sep 30, 2024
2 parents 0d192cb + 8fe51bf commit 02de248
Show file tree
Hide file tree
Showing 20 changed files with 1,031 additions and 1,111 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: test
args: --release --features no_lib_link
args: --workspace --release --features no_lib_link
env:
RUSTFLAGS: -Copt-level=3 -Cdebug-assertions -Coverflow-checks=y -Cdebuginfo=0 -C target-cpu=native
RUST_BACKTRACE: 1
Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/pr_emulator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ on:
push:
branches: [develop]
paths:
- 'emulator/**'
- 'riscv/**'
- 'core/**'
- "emulator/**"
- "riscv/**"
- "core/**"
pull_request:
branches:
- '**'
- "**"
paths:
- 'emulator/**'
- 'riscv/**'
- 'core/**'
- "emulator/**"
- "riscv/**"
- "core/**"

jobs:
docker-ziskof-check:
Expand All @@ -25,13 +25,12 @@ jobs:
- name: Checkout sources
uses: actions/checkout@v4

- uses: actions/checkout@v2
- name: Install rust
uses: actions-rs/toolchain@v1
with:
override: true
components: rustfmt, clippy
components: rustfmt, clippy
toolchain: stable

- name: Set up git private repo access
run: |
git config --global url."https://${{ secrets.ZISK_CI_TOKEN }}@github.com/".insteadOf ssh://[email protected]
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ pil-std-lib = { git = "https://github.com/0xPolygonHermez/pil2-proofman.git", br

p3-field = { git = "https://github.com/Plonky3/Plonky3.git", rev = "c3d754ef77b9fce585b46b972af751fe6e7a9803" }
log = "0.4"
rayon = "1.10"
rayon = "1.10"
6 changes: 2 additions & 4 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ mod utils;
mod zisk_definitions;
mod zisk_inst;
mod zisk_inst_builder;
mod zisk_operation;
mod zisk_operations;
mod zisk_required_operation;
mod zisk_rom;
mod zv2zisk;

pub mod zisk_ops;

pub use elf2rom::*;
pub use inst_context::*;
pub use mem::*;
Expand All @@ -22,8 +22,6 @@ pub use utils::*;
pub use zisk_definitions::*;
pub use zisk_inst::*;
pub use zisk_inst_builder::*;
pub use zisk_operation::*;
pub use zisk_operations::*;
pub use zisk_required_operation::*;
pub use zisk_rom::*;
pub use zv2zisk::*;
23 changes: 13 additions & 10 deletions core/src/zisk_inst_builder.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{
op_from_str, ZiskInst, ZiskOperationType, SRC_C, SRC_IMM, SRC_IND, SRC_MEM, SRC_STEP,
STORE_IND, STORE_MEM, STORE_NONE, SYS_ADDR,
zisk_ops::{InvalidNameError, OpType, ZiskOp},
ZiskInst, ZiskOperationType, SRC_C, SRC_IMM, SRC_IND, SRC_MEM, SRC_STEP, STORE_IND, STORE_MEM,
STORE_NONE, SYS_ADDR,
};

// #[cfg(feature = "sp")]
Expand All @@ -14,7 +15,8 @@ pub struct ZiskInstBuilder {
}

impl ZiskInstBuilder {
pub fn new(paddr: u64) -> ZiskInstBuilder {
#[inline]
pub const fn new(paddr: u64) -> ZiskInstBuilder {
let regs_addr = SYS_ADDR;

ZiskInstBuilder {
Expand Down Expand Up @@ -196,14 +198,15 @@ impl ZiskInstBuilder {
// self.i.set_sp = true;
// }

pub fn op(&mut self, optxt: &str) {
let op = op_from_str(optxt);
self.i.is_external_op = op.t != "i";
self.i.op = op.c;
self.i.op_str = op.n;
pub fn op(&mut self, optxt: &str) -> Result<(), InvalidNameError> {
let op = ZiskOp::try_from_name(optxt)?;
self.i.is_external_op = op.op_type() != OpType::Internal;
self.i.op = op.code();
self.i.op_str = op.name();
self.i.m32 = optxt.contains("_w");
self.i.func = op.f;
self.i.op_type = op.op_type();
self.i.func = op.get_call_function();
self.i.op_type = op.op_type().into();
Ok(())
}

pub fn j(&mut self, j1: i32, j2: i32) {
Expand Down
32 changes: 0 additions & 32 deletions core/src/zisk_operation.rs

This file was deleted.

Loading

0 comments on commit 02de248

Please sign in to comment.