Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make all ops but keccak and things that use Wrapping const fns 💥 #184

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 43 additions & 43 deletions core/src/zisk_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@

/// InstContext-based wrapper over op_flag()
#[inline(always)]
pub fn opc_flag(ctx: &mut InstContext) {
pub const fn opc_flag(ctx: &mut InstContext) {

Check failure on line 300 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_flag(ctx.a, ctx.b);
}

Expand All @@ -309,7 +309,7 @@

/// InstContext-based wrapper over op_copyb()
#[inline(always)]
pub fn opc_copyb(ctx: &mut InstContext) {
pub const fn opc_copyb(ctx: &mut InstContext) {

Check failure on line 312 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_copyb(ctx.a, ctx.b);
}

Expand All @@ -327,7 +327,7 @@

/// InstContext-based wrapper over op_signextend_b()
#[inline(always)]
pub fn opc_signextend_b(ctx: &mut InstContext) {
pub const fn opc_signextend_b(ctx: &mut InstContext) {

Check failure on line 330 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_signextend_b(ctx.a, ctx.b);
}

Expand All @@ -343,7 +343,7 @@

/// InstContext-based wrapper over op_signextend_h()
#[inline(always)]
pub fn opc_signextend_h(ctx: &mut InstContext) {
pub const fn opc_signextend_h(ctx: &mut InstContext) {

Check failure on line 346 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_signextend_h(ctx.a, ctx.b);
}

Expand All @@ -359,7 +359,7 @@

/// InstContext-based wrapper over op_signextend_w()
#[inline(always)]
pub fn opc_signextend_w(ctx: &mut InstContext) {
pub const fn opc_signextend_w(ctx: &mut InstContext) {

Check failure on line 362 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_signextend_w(ctx.a, ctx.b);
}

Expand Down Expand Up @@ -424,7 +424,7 @@

/// InstContext-based wrapper over op_sll()
#[inline(always)]
pub fn opc_sll(ctx: &mut InstContext) {
pub const fn opc_sll(ctx: &mut InstContext) {

Check failure on line 427 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_sll(ctx.a, ctx.b);
}

Expand All @@ -450,7 +450,7 @@

/// InstContext-based wrapper over op_sra()
#[inline(always)]
pub fn opc_sra(ctx: &mut InstContext) {
pub const fn opc_sra(ctx: &mut InstContext) {

Check failure on line 453 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_sra(ctx.a, ctx.b);
}

Expand All @@ -463,7 +463,7 @@

/// InstContext-based wrapper over op_srl()
#[inline(always)]
pub fn opc_srl(ctx: &mut InstContext) {
pub const fn opc_srl(ctx: &mut InstContext) {

Check failure on line 466 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_srl(ctx.a, ctx.b);
}

Expand Down Expand Up @@ -507,7 +507,7 @@

/// InstContext-based wrapper over op_eq()
#[inline(always)]
pub fn opc_eq(ctx: &mut InstContext) {
pub const fn opc_eq(ctx: &mut InstContext) {

Check failure on line 510 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_eq(ctx.a, ctx.b);
}

Expand All @@ -524,7 +524,7 @@

/// InstContext-based wrapper over op_eq_w()
#[inline(always)]
pub fn opc_eq_w(ctx: &mut InstContext) {
pub const fn opc_eq_w(ctx: &mut InstContext) {

Check failure on line 527 in core/src/zisk_ops.rs

View workflow job for this annotation

GitHub Actions / Docker Risc Oficial Tests Check

mutable references are not allowed in constant functions
(ctx.c, ctx.flag) = op_eq_w(ctx.a, ctx.b);
}

Expand All @@ -541,7 +541,7 @@

/// InstContext-based wrapper over op_ltu()
#[inline(always)]
pub fn opc_ltu(ctx: &mut InstContext) {
pub const fn opc_ltu(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_ltu(ctx.a, ctx.b);
}

Expand All @@ -558,7 +558,7 @@

/// InstContext-based wrapper over op_lt()
#[inline(always)]
pub fn opc_lt(ctx: &mut InstContext) {
pub const fn opc_lt(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_lt(ctx.a, ctx.b);
}

Expand All @@ -575,7 +575,7 @@

/// InstContext-based wrapper over op_ltu_w()
#[inline(always)]
pub fn opc_ltu_w(ctx: &mut InstContext) {
pub const fn opc_ltu_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_ltu_w(ctx.a, ctx.b);
}

Expand All @@ -592,7 +592,7 @@

/// InstContext-based wrapper over op_lt_w()
#[inline(always)]
pub fn opc_lt_w(ctx: &mut InstContext) {
pub const fn opc_lt_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_lt_w(ctx.a, ctx.b);
}

Expand All @@ -609,7 +609,7 @@

/// InstContext-based wrapper over op_leu()
#[inline(always)]
pub fn opc_leu(ctx: &mut InstContext) {
pub const fn opc_leu(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_leu(ctx.a, ctx.b);
}

Expand All @@ -626,7 +626,7 @@

/// InstContext-based wrapper over op_le()
#[inline(always)]
pub fn opc_le(ctx: &mut InstContext) {
pub const fn opc_le(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_le(ctx.a, ctx.b);
}

Expand All @@ -643,7 +643,7 @@

/// InstContext-based wrapper over op_leu_w()
#[inline(always)]
pub fn opc_leu_w(ctx: &mut InstContext) {
pub const fn opc_leu_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_leu_w(ctx.a, ctx.b);
}

Expand All @@ -660,7 +660,7 @@

/// InstContext-based wrapper over op_le_w()
#[inline(always)]
pub fn opc_le_w(ctx: &mut InstContext) {
pub const fn opc_le_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_le_w(ctx.a, ctx.b);
}

Expand All @@ -674,7 +674,7 @@

/// InstContext-based wrapper over op_and()
#[inline(always)]
pub fn opc_and(ctx: &mut InstContext) {
pub const fn opc_and(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_and(ctx.a, ctx.b);
}

Expand All @@ -686,7 +686,7 @@

/// InstContext-based wrapper over op_or()
#[inline(always)]
pub fn opc_or(ctx: &mut InstContext) {
pub const fn opc_or(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_or(ctx.a, ctx.b);
}

Expand All @@ -698,7 +698,7 @@

/// InstContext-based wrapper over op_xor()
#[inline(always)]
pub fn opc_xor(ctx: &mut InstContext) {
pub const fn opc_xor(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_xor(ctx.a, ctx.b);
}

Expand Down Expand Up @@ -748,7 +748,7 @@

/// InstContext-based wrapper over op_muluh()
#[inline(always)]
pub fn opc_muluh(ctx: &mut InstContext) {
pub const fn opc_muluh(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_muluh(ctx.a, ctx.b);
}

Expand All @@ -760,7 +760,7 @@

/// InstContext-based wrapper over op_mulh()
#[inline(always)]
pub fn opc_mulh(ctx: &mut InstContext) {
pub const fn opc_mulh(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_mulh(ctx.a, ctx.b);
}

Expand All @@ -772,7 +772,7 @@

/// InstContext-based wrapper over op_mulsuh()
#[inline(always)]
pub fn opc_mulsuh(ctx: &mut InstContext) {
pub const fn opc_mulsuh(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_mulsuh(ctx.a, ctx.b);
}

Expand All @@ -789,7 +789,7 @@

/// InstContext-based wrapper over op_divu()
#[inline(always)]
pub fn opc_divu(ctx: &mut InstContext) {
pub const fn opc_divu(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_divu(ctx.a, ctx.b);
}

Expand All @@ -808,7 +808,7 @@

/// InstContext-based wrapper over op_div()
#[inline(always)]
pub fn opc_div(ctx: &mut InstContext) {
pub const fn opc_div(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_div(ctx.a, ctx.b);
}

Expand All @@ -825,7 +825,7 @@

/// InstContext-based wrapper over op_divu_w()
#[inline(always)]
pub fn opc_divu_w(ctx: &mut InstContext) {
pub const fn opc_divu_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_divu_w(ctx.a, ctx.b);
}

Expand All @@ -842,7 +842,7 @@

/// InstContext-based wrapper over op_div_w()
#[inline(always)]
pub fn opc_div_w(ctx: &mut InstContext) {
pub const fn opc_div_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_div_w(ctx.a, ctx.b);
}

Expand All @@ -859,7 +859,7 @@

/// InstContext-based wrapper over op_remu()
#[inline(always)]
pub fn opc_remu(ctx: &mut InstContext) {
pub const fn opc_remu(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_remu(ctx.a, ctx.b);
}

Expand All @@ -876,7 +876,7 @@

/// InstContext-based wrapper over op_rem()
#[inline(always)]
pub fn opc_rem(ctx: &mut InstContext) {
pub const fn opc_rem(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_rem(ctx.a, ctx.b);
}

Expand All @@ -893,7 +893,7 @@

/// InstContext-based wrapper over op_remu_w()
#[inline(always)]
pub fn opc_remu_w(ctx: &mut InstContext) {
pub const fn opc_remu_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_remu_w(ctx.a, ctx.b);
}

Expand All @@ -910,7 +910,7 @@

/// InstContext-based wrapper over op_rem_w()
#[inline(always)]
pub fn opc_rem_w(ctx: &mut InstContext) {
pub const fn opc_rem_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_rem_w(ctx.a, ctx.b);
}

Expand All @@ -928,7 +928,7 @@

/// InstContext-based wrapper over op_minu()
#[inline(always)]
pub fn opc_minu(ctx: &mut InstContext) {
pub const fn opc_minu(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_minu(ctx.a, ctx.b);
}

Expand All @@ -944,7 +944,7 @@

/// InstContext-based wrapper over op_min()
#[inline(always)]
pub fn opc_min(ctx: &mut InstContext) {
pub const fn opc_min(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_min(ctx.a, ctx.b);
}

Expand All @@ -960,7 +960,7 @@

/// InstContext-based wrapper over op_minu_w()
#[inline(always)]
pub fn opc_minu_w(ctx: &mut InstContext) {
pub const fn opc_minu_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_minu_w(ctx.a, ctx.b);
}

Expand All @@ -976,7 +976,7 @@

/// InstContext-based wrapper over op_min_w()
#[inline(always)]
pub fn opc_min_w(ctx: &mut InstContext) {
pub const fn opc_min_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_min_w(ctx.a, ctx.b);
}

Expand All @@ -992,7 +992,7 @@

/// InstContext-based wrapper over op_maxu()
#[inline(always)]
pub fn opc_maxu(ctx: &mut InstContext) {
pub const fn opc_maxu(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_maxu(ctx.a, ctx.b);
}

Expand All @@ -1008,7 +1008,7 @@

/// InstContext-based wrapper over op_max()
#[inline(always)]
pub fn opc_max(ctx: &mut InstContext) {
pub const fn opc_max(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_max(ctx.a, ctx.b);
}

Expand All @@ -1024,7 +1024,7 @@

/// InstContext-based wrapper over op_maxu_w()
#[inline(always)]
pub fn opc_maxu_w(ctx: &mut InstContext) {
pub const fn opc_maxu_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_maxu_w(ctx.a, ctx.b);
}

Expand All @@ -1040,7 +1040,7 @@

/// InstContext-based wrapper over op_max_w()
#[inline(always)]
pub fn opc_max_w(ctx: &mut InstContext) {
pub const fn opc_max_w(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_max_w(ctx.a, ctx.b);
}

Expand Down Expand Up @@ -1077,8 +1077,8 @@
/// Unimplemented. Keccak can only be called from the system call context via InstContext.
/// This is provided just for completeness.
#[inline(always)]
pub fn op_keccak(_a: u64, _b: u64) -> (u64, bool) {
unimplemented!("op_keccak() is not implemented");
pub const fn op_keccak(_a: u64, _b: u64) -> (u64, bool) {
panic!("op_keccak() is not implemented");
}

impl From<ZiskRequiredOperation> for ZiskOp {
Expand All @@ -1096,7 +1096,7 @@

/// InstContext-based wrapper over op_pubout()
#[inline(always)]
pub fn opc_pubout(ctx: &mut InstContext) {
pub const fn opc_pubout(ctx: &mut InstContext) {
(ctx.c, ctx.flag) = op_pubout(ctx.a, ctx.b);
//println!("public ${} = {:#010x}", ctx.a, ctx.b);
}
Loading