Skip to content

Commit

Permalink
litex_sim: add ZeroMQ/JSON-based simctrl interface module
Browse files Browse the repository at this point in the history
Adds a module implementing the "simctrl"-style control & status
interface for the LiteX simulation. It uses a ZeroMQ/JSON-based
transport for the control, status and module messages. However,
modules are free to define their own format.

The passed messages make use of ZeroMQ multipart messages, for
instance to carry payloads to simctrl-supported modules in the
simulation. Thus, this module takes messages which contain a "simctrl
header" and a payload forwarded to the destination module.

Furthermore, the module implements some basic standalone status &
control functionality. It can be used to query the current wall clock
time, simulation time and instantiated module sessions. It can
furthermore halt and resume the simulation.

Signed-off-by: Leon Schuermann <leon@is.currently.online>
  • Loading branch information
lschuermann committed Nov 17, 2021
1 parent dbe664b commit 538ea26
Show file tree
Hide file tree
Showing 5 changed files with 752 additions and 3 deletions.
4 changes: 2 additions & 2 deletions litex/build/sim/core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
CFLAGS += -I/usr/local/include/
LDFLAGS += -L/usr/local/lib
LDFLAGS += -lpthread -ljson-c -lz -lm -lstdc++ -ldl -levent -rdynamic
LDFLAGS += -lpthread -ljson-c -lz -lzmq -lm -lstdc++ -ldl -levent -rdynamic
else
CC ?= gcc
CFLAGS += -ggdb
LDFLAGS += -lpthread -Wl,--no-as-needed -ljson-c -lz -lm -lstdc++ -Wl,--no-as-needed -ldl -levent -rdynamic
LDFLAGS += -lpthread -Wl,--no-as-needed -ljson-c -lz -lzmq -lm -lstdc++ -Wl,--no-as-needed -ldl -levent -rdynamic
endif

CFLAGS += -Wall -$(OPT_LEVEL) $(if $(COVERAGE), -DVM_COVERAGE) $(if $(TRACE_FST), -DTRACE_FST)
Expand Down
2 changes: 1 addition & 1 deletion litex/build/sim/core/modules/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include ../variables.mak
MODULES = xgmii_ethernet ethernet serial2console serial2tcp clocker spdeeprom gmii_ethernet
MODULES = simctrl xgmii_ethernet gmii_ethernet ethernet serial2console serial2tcp clocker spdeeprom

.PHONY: $(MODULES)
all: $(MODULES)
Expand Down
14 changes: 14 additions & 0 deletions litex/build/sim/core/modules/simctrl/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
include ../../variables.mak
UNAME_S := $(shell uname -s)

include $(SRC_DIR)/modules/rules.mak

CFLAGS += -I$(TAPCFG_DIRECTORY)/src/include
OBJS = $(MOD).o

$(MOD).so: $(OBJS)
ifeq ($(UNAME_S),Darwin)
$(CC) $(LDFLAGS) -o $@ $^
else
$(CC) $(LDFLAGS) -Wl,-soname,$@ -o $@ $^
endif
Loading

0 comments on commit 538ea26

Please sign in to comment.