2001-03-11 01:29:38 +01:00
|
|
|
#ifndef __vthread_H
|
|
|
|
|
#define __vthread_H
|
|
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2001 Stephen Williams (steve@icarus.com)
|
|
|
|
|
*
|
|
|
|
|
* This source code is free software; you can redistribute it
|
|
|
|
|
* and/or modify it in source code form under the terms of the GNU
|
|
|
|
|
* General Public License as published by the Free Software
|
|
|
|
|
* Foundation; either version 2 of the License, or (at your option)
|
|
|
|
|
* any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
|
|
|
*/
|
|
|
|
|
#if !defined(WINNT)
|
2001-05-10 02:26:53 +02:00
|
|
|
#ident "$Id: vthread.h,v 1.6 2001/05/10 00:26:53 steve Exp $"
|
2001-03-11 01:29:38 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* A vthread is a simulation thread that executes instructions when
|
|
|
|
|
* they are scheduled. This structure contains all the thread specific
|
|
|
|
|
* context needed to run an instruction.
|
|
|
|
|
*
|
|
|
|
|
* Included in a thread are its program counter, local bits and
|
|
|
|
|
* members needed for tracking the thread. The thread runs by fetching
|
|
|
|
|
* instructions from code space, interpreting the instruction, then
|
|
|
|
|
* fetching the next instruction.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
typedef struct vthread_s*vthread_t;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* This creates a new simulation thread, with the given start
|
|
|
|
|
* address. The generated thread is ready to run, but is not yet
|
|
|
|
|
* scheduled.
|
|
|
|
|
*/
|
2001-04-18 06:21:23 +02:00
|
|
|
extern vthread_t vthread_new(unsigned long sa, struct __vpiScope*scope);
|
2001-03-11 01:29:38 +01:00
|
|
|
|
2001-04-21 02:34:39 +02:00
|
|
|
/*
|
|
|
|
|
* This function marks the thread as scheduled. It is used only by the
|
|
|
|
|
* schedule_vthread function.
|
|
|
|
|
*/
|
|
|
|
|
extern void vthread_mark_scheduled(vthread_t thr);
|
|
|
|
|
|
2001-03-11 01:29:38 +01:00
|
|
|
/*
|
|
|
|
|
* Cause this thread to execute instructions until in is put to sleep
|
|
|
|
|
* by executing some sort of delay or wait instruction.
|
|
|
|
|
*/
|
|
|
|
|
extern void vthread_run(vthread_t thr);
|
|
|
|
|
|
2001-03-26 06:00:39 +02:00
|
|
|
/*
|
|
|
|
|
* This function schedules all the threads in the list to be scheduled
|
2001-04-13 05:55:18 +02:00
|
|
|
* for execution with delay 0. The thr pointer is taken to be the head
|
|
|
|
|
* of a list, and all the threads in the list are presumably placed in
|
|
|
|
|
* the list by the %wait instruction.
|
2001-03-26 06:00:39 +02:00
|
|
|
*/
|
|
|
|
|
extern void vthread_schedule_list(vthread_t thr);
|
|
|
|
|
|
|
|
|
|
|
2001-05-10 02:26:53 +02:00
|
|
|
/*
|
|
|
|
|
** Return a bit from the thread's bit space;
|
|
|
|
|
*/
|
|
|
|
|
unsigned vthread_get_bit(struct vthread_s*thr, unsigned addr);
|
|
|
|
|
void vthread_put_bit(struct vthread_s*thr, unsigned addr, unsigned bit);
|
|
|
|
|
|
2001-03-11 01:29:38 +01:00
|
|
|
/*
|
|
|
|
|
* $Log: vthread.h,v $
|
2001-05-10 02:26:53 +02:00
|
|
|
* Revision 1.6 2001/05/10 00:26:53 steve
|
|
|
|
|
* VVP support for memories in expressions,
|
|
|
|
|
* including general support for thread bit
|
|
|
|
|
* vectors as system task parameters.
|
|
|
|
|
* (Stephan Boettcher)
|
|
|
|
|
*
|
2001-04-21 02:34:39 +02:00
|
|
|
* Revision 1.5 2001/04/21 00:34:39 steve
|
|
|
|
|
* Working %disable and reap handling references from scheduler.
|
|
|
|
|
*
|
2001-04-18 06:21:23 +02:00
|
|
|
* Revision 1.4 2001/04/18 04:21:23 steve
|
|
|
|
|
* Put threads into scopes.
|
|
|
|
|
*
|
2001-04-13 05:55:18 +02:00
|
|
|
* Revision 1.3 2001/04/13 03:55:18 steve
|
|
|
|
|
* More complete reap of all threads.
|
|
|
|
|
*
|
2001-03-26 06:00:39 +02:00
|
|
|
* Revision 1.2 2001/03/26 04:00:39 steve
|
|
|
|
|
* Add the .event statement and the %wait instruction.
|
|
|
|
|
*
|
2001-03-11 01:29:38 +01:00
|
|
|
* Revision 1.1 2001/03/11 00:29:39 steve
|
|
|
|
|
* Add the vvp engine to cvs.
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
#endif
|