From 5af1f7c1940d706428774e78b74095f1bb1cd572 Mon Sep 17 00:00:00 2001 From: thealmarty <“thealmartyblog@gmail.com”> Date: Wed, 17 Jan 2024 09:30:05 -0800 Subject: [PATCH] Update assembler. --- assembler/grammar/assembly.pest | 2 +- assembler/src/lib.rs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/assembler/grammar/assembly.pest b/assembler/grammar/assembly.pest index dacb01ed..c82955da 100644 --- a/assembler/grammar/assembly.pest +++ b/assembler/grammar/assembly.pest @@ -7,7 +7,7 @@ mnemonic = { "advread" | "advwrite" | "addi" | "add" | "subi" | "sub" | "muli" | "mul" | "mulhsi"| "mulhui"| "mulhs"| "mulhu" | "divi" | "div" | "sdiv" | "sdivi" | "lti" | "lt" | "shli" | "shl" | "shri" | "shr" | "srai" | "sra" | - "andi" | "and" | "ori" | "or" | "xori" | "xor" | + "andi" | "and" | "ori" | "or" | "xori" | "xor" | "nei" | "ne" | "eqi" | "eq" | "feadd" | "fesub" | "femul" | "write" } diff --git a/assembler/src/lib.rs b/assembler/src/lib.rs index 1243344c..890949a4 100644 --- a/assembler/src/lib.rs +++ b/assembler/src/lib.rs @@ -84,6 +84,8 @@ pub fn assemble(input: &str) -> Result, String> { "and" | "andi" => AND32, "or" | "ori" => OR32, "xor" | "xori" => XOR32, + "ne" | "nei" => NE32, + "eq" | "eqi" => EQ32, // Native field "feadd" => ADD, @@ -116,12 +118,14 @@ pub fn assemble(input: &str) -> Result, String> { operands.extend(vec![0; 5]); } "add" | "sub" | "mul" | "mulhs" | "mulhu" | "div" | "lt" | "shl" | "shr" - | "sra" | "beq" | "bne" | "and" | "or" | "xor" | "jal" | "jalv" => { + | "sra" | "beq" | "bne" | "and" | "or" | "xor" | "ne" | "eq" | "jal" + | "jalv" => { // (a, b, c, 0, 0) operands.extend(vec![0; 2]); } "addi" | "subi" | "muli" | "mulhsi" | "mulhui" | "divi" | "sdivi" | "lti" - | "shli" | "shri" | "srai" | "beqi" | "bnei" | "andi" | "ori" | "xori" => { + | "shli" | "shri" | "srai" | "beqi" | "bnei" | "andi" | "ori" | "xori" + | "nei" | "eqi" => { // (a, b, c, 0, 1) operands.extend(vec![0, 1]); }