zafir Posted February 20, 2021 Report Posted February 20, 2021 Hi, I am new to this forum and tried to look for FAQ but did not find answer. If it is not relevant please delete my post and sorry. I have query that is this possible that linux kernel module (like ethernet driver) can communicate with systemC process running on simulator? We need to pass live network traffic to our simulation and need to know is this possible? thanks. Regards Zafir Quote
Eyck Posted February 20, 2021 Report Posted February 20, 2021 Yes, it is possible. Since SystemC is basically a C++ class library you can you whatever C/C++ allows for. zafir 1 Quote
zafir Posted February 20, 2021 Author Report Posted February 20, 2021 Hi, Thanks for your prompt response, follow up query is that systemC simulator we run in userspace (please correct me if I am wrong) of linux, so I am assuming it is a linux process. We have some transports available like netlink socket that allow to pass information from kernel to userspace. so can we use netlink socket in systemC simulators? Second question that is this possible to run systemC simulator as a kernel module in linux kernel not in user space? I mean systemC library can be used directly in kernel of linux? if there is any open example or tutorial for above queries it would be very helpful if you can refer. Thanks for your time. Regards Zafir Quote
Eyck Posted February 26, 2021 Report Posted February 26, 2021 No, you cannot run the SystemC simulator kernel as a Linux kernel module for sevberal reasons: SystemC requires quite some libraries (libc, libqt, ...) that are not available in kernel space You would taint the kernel and open up a security hole large as a gate. You would alos risk the system integrity. SystemC is simply not meant for such things. A proper design would make a distinction between (as little as possibel) code to run in kernel space providing interfaces (devices or shared memory) to interact with and a userspace application which could be the SystemC simulation e.g. running as a daemon. Even linux kernel hackers move everything into this direction... Yes, the simulation is a simple userspace process being constraint by the OS permissions. So it can use all resources a process is allowed. It can open socket connections and ports and whatever it needs. In the past I wrote some interface which allowed the SystemC simulation running on a Linux system to talk to another simulator running on a Windows host using network sockets (it also worked with UNIX domain sockets). And actually we are implementing a SystemC simulation talking to an FPGA on an accelerator card via device files. Unfortunately I'm not aware of freely available examples to do so. But if you have some C/C++ code to deal with the netlink sockets you can just embed this code into the simulator e.g. as part of a sc_module and tie it to the simulation phases (open the socket during start_of_simulation(), closing them during end_of_simulation()). zafir 1 Quote
David Black Posted April 11, 2021 Report Posted April 11, 2021 Be aware that SystemC kernel is not threadsafe with exception of async_request_update(). So you must code accordingly. Shashank V M 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.