Skip to content

Commit

Permalink
ADD: sigcheck for asm.
Browse files Browse the repository at this point in the history
  • Loading branch information
web3Softcloud committed Jan 5, 2024
1 parent a9a2dab commit 0d7b4e6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
9 changes: 7 additions & 2 deletions assembler/src/asm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,16 @@ fn split_ola_asm_pieces(
| OlaOpcode::TSTORE
| OlaOpcode::SCCALL
| OlaOpcode::SLOAD
| OlaOpcode::SSTORE => {
| OlaOpcode::SSTORE
| OlaOpcode::SIGCHECK => {
if ops.len() != 2 {
return Err(format!("invalid operand size: {}", asm_line));
}
if opcode == OlaOpcode::MOV || opcode == OlaOpcode::NOT || opcode == OlaOpcode::MLOAD {
if opcode == OlaOpcode::MOV
|| opcode == OlaOpcode::NOT
|| opcode == OlaOpcode::MLOAD
|| opcode == OlaOpcode::SIGCHECK
{
let dst = ops.get(0).unwrap();
let op1 = ops.get(1).unwrap();
Ok((opcode, None, Some(op1.clone()), Some(dst.clone())))
Expand Down
6 changes: 5 additions & 1 deletion core/src/program/binary_program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,11 @@ impl BinaryInstruction {
)
}

OlaOpcode::MOV | OlaOpcode::NOT | OlaOpcode::MLOAD | OlaOpcode::TSTORE => {
OlaOpcode::MOV
| OlaOpcode::NOT
| OlaOpcode::MLOAD
| OlaOpcode::TSTORE
| OlaOpcode::SIGCHECK => {
format!(
"{} {} {}",
self.opcode.token(),
Expand Down
3 changes: 3 additions & 0 deletions core/src/vm/opcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub enum OlaOpcode {
TLOAD,
TSTORE,
SCCALL,
SIGCHECK,
}

impl Display for OlaOpcode {
Expand Down Expand Up @@ -68,6 +69,7 @@ impl OlaOpcode {
OlaOpcode::TLOAD => "tload".to_string(),
OlaOpcode::TSTORE => "tstore".to_string(),
OlaOpcode::SCCALL => "sccall".to_string(),
OlaOpcode::SIGCHECK => "sigcheck".to_string(),
}
}

Expand Down Expand Up @@ -98,6 +100,7 @@ impl OlaOpcode {
OlaOpcode::TLOAD => 9,
OlaOpcode::TSTORE => 8,
OlaOpcode::SCCALL => 7,
OlaOpcode::SIGCHECK => 6,
}
}

Expand Down

0 comments on commit 0d7b4e6

Please sign in to comment.