Add the %shiftl/i0 instruction.

This commit is contained in:
steve 2001-06-23 18:26:26 +00:00
parent 3c5d32637c
commit a2d465804f
5 changed files with 50 additions and 5 deletions

View File

@ -19,7 +19,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #if !defined(WINNT)
#ident "$Id: codes.h,v 1.29 2001/06/18 01:09:32 steve Exp $" #ident "$Id: codes.h,v 1.30 2001/06/23 18:26:26 steve Exp $"
#endif #endif
@ -72,6 +72,7 @@ extern bool of_OR(vthread_t thr, vvp_code_t code);
extern bool of_ORR(vthread_t thr, vvp_code_t code); extern bool of_ORR(vthread_t thr, vvp_code_t code);
extern bool of_SET(vthread_t thr, vvp_code_t code); extern bool of_SET(vthread_t thr, vvp_code_t code);
extern bool of_SET_MEM(vthread_t thr, vvp_code_t code); extern bool of_SET_MEM(vthread_t thr, vvp_code_t code);
extern bool of_SHIFTL_I0(vthread_t thr, vvp_code_t code);
extern bool of_SUB(vthread_t thr, vvp_code_t code); extern bool of_SUB(vthread_t thr, vvp_code_t code);
extern bool of_VPI_CALL(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); extern bool of_WAIT(vthread_t thr, vvp_code_t code);
@ -134,6 +135,9 @@ extern vvp_code_t codespace_index(vvp_cpoint_t ptr);
/* /*
* $Log: codes.h,v $ * $Log: codes.h,v $
* Revision 1.30 2001/06/23 18:26:26 steve
* Add the %shiftl/i0 instruction.
*
* Revision 1.29 2001/06/18 01:09:32 steve * Revision 1.29 2001/06/18 01:09:32 steve
* More behavioral unary reduction operators. * More behavioral unary reduction operators.
* (Stephan Boettcher) * (Stephan Boettcher)

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #if !defined(WINNT)
#ident "$Id: compile.cc,v 1.80 2001/06/23 01:04:07 steve Exp $" #ident "$Id: compile.cc,v 1.81 2001/06/23 18:26:26 steve Exp $"
#endif #endif
# include "arith.h" # include "arith.h"
@ -111,6 +111,7 @@ const static struct opcode_table_s opcode_table[] = {
{ "%or/r", of_ORR, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, { "%or/r", of_ORR, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
{ "%set", of_SET, 2, {OA_FUNC_PTR, OA_BIT1, OA_NONE} }, { "%set", of_SET, 2, {OA_FUNC_PTR, OA_BIT1, OA_NONE} },
{ "%set/m", of_SET_MEM,2, {OA_MEM_PTR, OA_BIT1, OA_NONE} }, { "%set/m", of_SET_MEM,2, {OA_MEM_PTR, OA_BIT1, OA_NONE} },
{ "%shiftl/i0", of_SHIFTL_I0, 2, {OA_BIT1,OA_NUMBER, OA_NONE} },
{ "%sub", of_SUB, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, { "%sub", of_SUB, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
{ "%wait", of_WAIT, 1, {OA_FUNC_PTR, OA_NONE, OA_NONE} }, { "%wait", of_WAIT, 1, {OA_FUNC_PTR, OA_NONE, OA_NONE} },
{ "%xnor", of_XNOR, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} }, { "%xnor", of_XNOR, 3, {OA_BIT1, OA_BIT2, OA_NUMBER} },
@ -1448,6 +1449,9 @@ vvp_ipoint_t debug_lookup_functor(const char*name)
/* /*
* $Log: compile.cc,v $ * $Log: compile.cc,v $
* Revision 1.81 2001/06/23 18:26:26 steve
* Add the %shiftl/i0 instruction.
*
* Revision 1.80 2001/06/23 01:04:07 steve * Revision 1.80 2001/06/23 01:04:07 steve
* Allow forward references of task scopes. (Stephan Boettcher) * Allow forward references of task scopes. (Stephan Boettcher)
* *

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #if !defined(WINNT)
#ident "$Id: main.cc,v 1.15 2001/06/12 03:53:11 steve Exp $" #ident "$Id: main.cc,v 1.16 2001/06/23 18:26:26 steve Exp $"
#endif #endif
# include "config.h" # include "config.h"
@ -27,6 +27,7 @@
# include "schedule.h" # include "schedule.h"
# include "vpi_priv.h" # include "vpi_priv.h"
# include <stdio.h> # include <stdio.h>
# include <stdlib.h>
#if defined(HAVE_GETOPT_H) #if defined(HAVE_GETOPT_H)
# include <getopt.h> # include <getopt.h>
#endif #endif
@ -111,6 +112,9 @@ int main(int argc, char*argv[])
/* /*
* $Log: main.cc,v $ * $Log: main.cc,v $
* Revision 1.16 2001/06/23 18:26:26 steve
* Add the %shiftl/i0 instruction.
*
* Revision 1.15 2001/06/12 03:53:11 steve * Revision 1.15 2001/06/12 03:53:11 steve
* Change the VPI call process so that loaded .vpi modules * Change the VPI call process so that loaded .vpi modules
* use a function table instead of implicit binding. * use a function table instead of implicit binding.

View File

@ -1,7 +1,7 @@
/* /*
* Copyright (c) 2001 Stephen Williams (steve@icarus.com) * Copyright (c) 2001 Stephen Williams (steve@icarus.com)
* *
* $Id: opcodes.txt,v 1.23 2001/06/16 23:45:05 steve Exp $ * $Id: opcodes.txt,v 1.24 2001/06/23 18:26:26 steve Exp $
*/ */
@ -293,6 +293,13 @@ address zero is the LSB of the first memory word. This instruction
sets only a single bit. sets only a single bit.
* %shiftl/i0 <bit>, <wid>
This instruction shifts the vector left (towards more significant
bits) by the amount in index register 0. The <bit> is the address of
the lsb of the vector, and <wid> the width of the vector. The shift is
done in place. Zero values are shifted in.
* %sub <bit-l>, <bit-r>, <wid> * %sub <bit-l>, <bit-r>, <wid>
This instruction arithmetically subtracts the right vector out of the This instruction arithmetically subtracts the right vector out of the

View File

@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/ */
#if !defined(WINNT) #if !defined(WINNT)
#ident "$Id: vthread.cc,v 1.45 2001/06/22 00:03:05 steve Exp $" #ident "$Id: vthread.cc,v 1.46 2001/06/23 18:26:26 steve Exp $"
#endif #endif
# include "vthread.h" # include "vthread.h"
@ -30,6 +30,7 @@
# include <string.h> # include <string.h>
# include <assert.h> # include <assert.h>
#include <stdio.h>
/* /*
* This vhtread_s structure describes all there is to know about a * This vhtread_s structure describes all there is to know about a
* thread, including its program counter, all the private bits it * thread, including its program counter, all the private bits it
@ -1076,6 +1077,28 @@ bool of_SET_MEM(vthread_t thr, vvp_code_t cp)
return true; return true;
} }
bool of_SHIFTL_I0(vthread_t thr, vvp_code_t cp)
{
unsigned base = cp->bit_idx1;
unsigned wid = cp->number;
long shift = thr->index[0];
if (shift >= wid) {
for (unsigned idx = 0 ; idx < wid ; idx += 1)
thr_put_bit(thr, base+idx, 0);
} else if (shift > 0) {
for (unsigned idx = wid ; idx > shift ; idx -= 1) {
unsigned src = base+idx-shift-1;
unsigned dst = base + idx - 1;
thr_put_bit(thr, dst, thr_get_bit(thr, src));
}
for (unsigned idx = 0 ; idx < shift ; idx += 1)
thr_put_bit(thr, base+idx, 0);
}
return true;
}
bool of_SUB(vthread_t thr, vvp_code_t cp) bool of_SUB(vthread_t thr, vvp_code_t cp)
{ {
assert(cp->bit_idx1 >= 4); assert(cp->bit_idx1 >= 4);
@ -1226,6 +1249,9 @@ bool of_ZOMBIE(vthread_t thr, vvp_code_t)
/* /*
* $Log: vthread.cc,v $ * $Log: vthread.cc,v $
* Revision 1.46 2001/06/23 18:26:26 steve
* Add the %shiftl/i0 instruction.
*
* Revision 1.45 2001/06/22 00:03:05 steve * Revision 1.45 2001/06/22 00:03:05 steve
* Infinitely wide behavioral add. * Infinitely wide behavioral add.
* *