From 5769bbe15ed1db39c6b6001eaeb9f60d29a54fb2 Mon Sep 17 00:00:00 2001 From: steve Date: Sun, 1 Apr 2001 06:12:13 +0000 Subject: [PATCH] Add the bitwise %and instruction. --- vvp/codes.h | 10 +++++++--- vvp/compile.cc | 7 ++++++- vvp/opcodes.txt | 13 ++++++++++++- vvp/vthread.cc | 35 ++++++++++++++++++++++++++++++++++- 4 files changed, 59 insertions(+), 6 deletions(-) diff --git a/vvp/codes.h b/vvp/codes.h index bf37de492..0d85ab119 100644 --- a/vvp/codes.h +++ b/vvp/codes.h @@ -19,7 +19,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: codes.h,v 1.11 2001/04/01 04:34:28 steve Exp $" +#ident "$Id: codes.h,v 1.12 2001/04/01 06:12:13 steve Exp $" #endif @@ -36,6 +36,7 @@ typedef bool (*vvp_code_fun)(vthread_t thr, vvp_code_t code); * access to the thread context. */ extern bool of_ADD(vthread_t thr, vvp_code_t code); +extern bool of_AND(vthread_t thr, vvp_code_t code); extern bool of_ASSIGN(vthread_t thr, vvp_code_t code); extern bool of_CMPU(vthread_t thr, vvp_code_t code); extern bool of_CMPX(vthread_t thr, vvp_code_t code); @@ -51,10 +52,10 @@ extern bool of_JMP1(vthread_t thr, vvp_code_t code); extern bool of_JOIN(vthread_t thr, vvp_code_t code); extern bool of_LOAD(vthread_t thr, vvp_code_t code); extern bool of_MOV(vthread_t thr, vvp_code_t code); -extern bool of_SET(vthread_t thr, vvp_code_t code); -extern bool of_WAIT(vthread_t thr, vvp_code_t code); extern bool of_NOOP(vthread_t thr, vvp_code_t code); +extern bool of_SET(vthread_t thr, vvp_code_t code); extern bool of_VPI_CALL(vthread_t thr, vvp_code_t code); +extern bool of_WAIT(vthread_t thr, vvp_code_t code); /* * This is the format of a machine code instruction. @@ -99,6 +100,9 @@ extern void codespace_dump(FILE*fd); /* * $Log: codes.h,v $ + * Revision 1.12 2001/04/01 06:12:13 steve + * Add the bitwise %and instruction. + * * Revision 1.11 2001/04/01 04:34:28 steve * Implement %cmp/x and %cmp/z instructions. * diff --git a/vvp/compile.cc b/vvp/compile.cc index f55c4e827..1d0b926b7 100644 --- a/vvp/compile.cc +++ b/vvp/compile.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #if !defined(WINNT) -#ident "$Id: compile.cc,v 1.23 2001/04/01 04:34:28 steve Exp $" +#ident "$Id: compile.cc,v 1.24 2001/04/01 06:12:13 steve Exp $" #endif # include "compile.h" @@ -66,6 +66,7 @@ struct opcode_table_s { const static struct opcode_table_s opcode_table[] = { { "%add", of_ADD, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, + { "%and", of_AND, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, { "%assign", of_ASSIGN, 3, {OA_FUNC_PTR, OA_BIT1, OA_BIT2} }, { "%cmp/u", of_CMPU, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, { "%cmp/x", of_CMPX, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, @@ -81,6 +82,7 @@ const static struct opcode_table_s opcode_table[] = { { "%join", of_JOIN, 0, {OA_NONE, OA_NONE, OA_NONE} }, { "%load", of_LOAD, 2, {OA_BIT1, OA_FUNC_PTR, OA_NONE} }, { "%mov", of_MOV, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, + { "%noop", of_NOOP, 0, {OA_NONE, OA_NONE, OA_NONE} }, { "%set", of_SET, 2, {OA_FUNC_PTR, OA_BIT1, OA_NONE} }, { "%wait", of_WAIT, 1, {OA_FUNC_PTR, OA_NONE, OA_NONE} }, { 0, of_NOOP, 0, {OA_NONE, OA_NONE, OA_NONE} } @@ -694,6 +696,9 @@ void compile_dump(FILE*fd) /* * $Log: compile.cc,v $ + * Revision 1.24 2001/04/01 06:12:13 steve + * Add the bitwise %and instruction. + * * Revision 1.23 2001/04/01 04:34:28 steve * Implement %cmp/x and %cmp/z instructions. * diff --git a/vvp/opcodes.txt b/vvp/opcodes.txt index 832668f4d..d6d79d967 100644 --- a/vvp/opcodes.txt +++ b/vvp/opcodes.txt @@ -1,7 +1,7 @@ /* * Copyright (c) 2001 Stephen Williams (steve@icarus.com) * - * $Id: opcodes.txt,v 1.8 2001/03/31 01:59:59 steve Exp $ + * $Id: opcodes.txt,v 1.9 2001/04/01 06:12:14 steve Exp $ */ @@ -20,6 +20,17 @@ vectors having the width . If any of the bits of either vector are x or z, the result is x. Otherwise, the result is the arithmetic sum. +* %and , , + +Perform the bitwise AND of the two vectors, and store the result in +the left vector. Each bit is calculated independent of other bits. AND +means the following: + + 0 and ? --> 0 + ? and 0 --> 0 + 1 and 1 --> 1 + otherwise x + * %assign , , This does a non-blocking assignment to a variable. The