Jump to content

SystemC communication with Linux kernel Module


zafir

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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()).

Link to comment
Share on other sites

  • 1 month later...

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...