virtual interfaces in xsim?

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
User avatar
errordeveloper
Active Member
Posts: 50
Joined: Wed Dec 16, 2009 6:04 pm
Location: London
Contact:

virtual interfaces in xsim?

Post by errordeveloper »

are there any ways of simulating ethernet virtual network interface or socket using xsim simulator?
Last edited by errordeveloper on Thu Oct 20, 2011 11:14 am, edited 1 time in total.


User avatar
Berni
Respected Member
Posts: 363
Joined: Thu Dec 10, 2009 10:17 pm
Contact:

Post by Berni »

Dream on. The only hardware emulation you have is connecting pins together.
User avatar
kris
Experienced Member
Posts: 84
Joined: Mon Jan 18, 2010 2:52 pm

Post by kris »

xsim does support user created plugins and testbenches, which can be used to model any external interface/peripherial/system. These are created in c/c++, and can act as an alternative to using the pin loopbacks for verification. There are basically 2 ways in which these can be used:

1) Plugin: Users can create plugins (dlls), which get called from xsim each cycle and have access to the pins, switch, memory, etc.
2) Testbench: In this mode xsim is the slave, and the user would need to write the system (i.e. main), and again has access to the xcores pins, memory etc.

This feature is avaliable in the 10.4 tools, although is not extensivley used at present and is not fully documented. However, the best place to get started with this is to look at the examples that come with the tools. The plugin/testbench code can be found in src/, and the target (xc) code is in examples/. Not sure if this is what you need in this case, but let me know if you have any questions about it.

Cheers,
Kris.
User avatar
kris
Experienced Member
Posts: 84
Joined: Mon Jan 18, 2010 2:52 pm

Post by kris »

Just incase you are interested, attached is an example simulator plugin that reads the pwm output on given pin, and displays the % duty cycle on each pwm cycle. This also shows how the target code can communicate with the plugin using the custom syscall mechanism and how the plugin can communicate with the target code via target memory reads/writes.
Attachments
pwm.tar.gz
(1.66 KiB) Downloaded 311 times
pwm.tar.gz
(1.66 KiB) Downloaded 311 times
User avatar
snowman
Member
Posts: 13
Joined: Fri Dec 11, 2009 10:51 am
Contact:

Post by snowman »

I have written an Ethernet MII receive and transmit plugins in the past. They've gone out of date since - source attached for your reference. It can be used for basic dumb communication like send/receive a UDP packet. It has no intelligence, just an XML file that describes the order and timing of received and sent packets.

A network emulating plugin could be a bit too heavyweight for the simulator. Also, the simulator loopback connection gives you very much the same functionality (with two nodes, each running its own copy of the network stack and own IP address) without having to write/port an entire stack.
Attachments
EthernetMII.zip
(18.89 KiB) Downloaded 284 times
EthernetMII.zip
(18.89 KiB) Downloaded 284 times
User avatar
errordeveloper
Active Member
Posts: 50
Joined: Wed Dec 16, 2009 6:04 pm
Location: London
Contact:

Post by errordeveloper »

snowman wrote: A network emulating plugin could be a bit too heavyweight for the simulator. Also, the simulator loopback connection gives you very much the same functionality (with two nodes, each running its own copy of the network stack and own IP address) without having to write/port an entire stack.
That's exactly what i need! Thanx very much, snowman!
I didn't mean 'network' as in a bunch of nodes, loopback is what actually meant ;))
User avatar
errordeveloper
Active Member
Posts: 50
Joined: Wed Dec 16, 2009 6:04 pm
Location: London
Contact:

Post by errordeveloper »

kris wrote:Just incase you are interested, attached is an example simulator plugin that reads the pwm output on given pin, and displays the % duty cycle on each pwm cycle. This also shows how the target code can communicate with the plugin using the custom syscall mechanism and how the plugin can communicate with the target code via target memory reads/writes.
That would very useful for my project too!
Appreciated, that's great :)
Post Reply