CIRCT  19.0.0git
signals-runtime-wrappers.h
Go to the documentation of this file.
1 //===- signals-runtime-wrappers.h - Simulation runtime library --*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Defines the runtime library used in LLHD simulation.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef CIRCT_DIALECT_LLHD_SIMULATOR_SIGNALS_RUNTIME_WRAPPERS_H
14 #define CIRCT_DIALECT_LLHD_SIMULATOR_SIGNALS_RUNTIME_WRAPPERS_H
15 
17 
18 extern "C" {
19 
20 //===----------------------------------------------------------------------===//
21 // Runtime interfaces
22 //===----------------------------------------------------------------------===//
23 
24 /// Allocate a new signal. The index of the new signal in the state's list of
25 /// signals is returned.
26 int allocSignal(circt::llhd::sim::State *state, int index, char *owner,
27  uint8_t *value, int64_t size);
28 
29 /// Add offset and size information for the elements of an array signal.
30 void addSigArrayElements(circt::llhd::sim::State *state, unsigned index,
31  unsigned size, unsigned numElements);
32 
33 /// Add offset and size information for one element of a struct signal. Elements
34 /// are assumed to be added (by calling this function) in sequential order, from
35 /// first to last.
36 void addSigStructElement(circt::llhd::sim::State *state, unsigned index,
37  unsigned offset, unsigned size);
38 
39 /// Add allocated constructs to a process instance.
40 void allocProc(circt::llhd::sim::State *state, char *owner,
41  circt::llhd::sim::ProcState *procState);
42 
43 /// Add allocated entity state to the given instance.
44 void allocEntity(circt::llhd::sim::State *state, char *owner,
45  uint8_t *entityState);
46 
47 /// Drive a value onto a signal.
49  circt::llhd::sim::SignalDetail *index, uint8_t *value,
50  uint64_t width, int time, int delta, int eps);
51 
52 /// Suspend a process.
54  circt::llhd::sim::ProcState *procState, int time, int delta,
55  int eps);
56 }
57 
58 #endif // CIRCT_DIALECT_LLHD_SIMULATOR_SIGNALS_RUNTIME_WRAPPERS_H
MlirType uint64_t numElements
Definition: CHIRRTL.cpp:30
int32_t width
Definition: FIRRTL.cpp:36
void addSigArrayElements(circt::llhd::sim::State *state, unsigned index, unsigned size, unsigned numElements)
Add offset and size information for the elements of an array signal.
void addSigStructElement(circt::llhd::sim::State *state, unsigned index, unsigned offset, unsigned size)
Add offset and size information for one element of a struct signal.
int allocSignal(circt::llhd::sim::State *state, int index, char *owner, uint8_t *value, int64_t size)
Allocate a new signal.
void allocProc(circt::llhd::sim::State *state, char *owner, circt::llhd::sim::ProcState *procState)
Add allocated constructs to a process instance.
void driveSignal(circt::llhd::sim::State *state, circt::llhd::sim::SignalDetail *index, uint8_t *value, uint64_t width, int time, int delta, int eps)
Drive a value onto a signal.
void llhdSuspend(circt::llhd::sim::State *state, circt::llhd::sim::ProcState *procState, int time, int delta, int eps)
Suspend a process.
void allocEntity(circt::llhd::sim::State *state, char *owner, uint8_t *entityState)
Add allocated entity state to the given instance.
State structure for process persistence across suspension.
Definition: State.h:269
Detail structure that can be easily accessed by the lowered code.
Definition: State.h:68
The simulator's state.
Definition: State.h:306