Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
$ root@localhost:~# startx
Just a tip
Please, notice that from now on, the following convention is being used:
root@localhost:~# This is the current command line prompt (italics)
startx This is what you need to type at the command prompt (bold italics)
Now, after some seconds, you should be able to see a familiar Ubuntu 12.04-like interface
1
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
Xillinux is an Ubuntu-based linux distribution, but its kernel has been compiled to run
within the Zynqs ARM A9 architecture and to provide direct access to Xillybus. Well
now navigate through the available devices to discover the Xillybus interfaces that can
be accessed directly from the OS. First, open a shell prompt window pressing
Ctrl+Alt+T
Now, well display the files where the Xillybus pipes are connected to. To do so, type:
root@localhost:~# ls /dev/xillybus_*
2
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
If everything is built using default configuration, you should see the list as is shown
above. However, if a custom architecture was made using Xillybuss IP-Core Factory,
other interfaces may (dis)appear.
As this is an introductory tutorial, well focus only on 8- and 32- bit read/write interfaces.
This interfaces (or pipes) can be directly accessed through any programming language,
or even from Linux shell prompt as files.
3
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
Just a tip
FPGA -> ARM PS means data is being transferred from FPGA to ARM PS
ARM PS stands for ARM Processing System
Asynchronous interfaces use (most of the times) DMA transfers and are mostly
intended to be used in high throughput applications
Synchronous interfaces are intended to be used in low-latency and time-critical
applications
To deepen more on how asynchronous and synchronous memory interfaces
differ, please refer to Xillybus host application programming guide for Linux,
section 2.1
4
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
Well be writing data directly to the xillybus_write_(8/32) buses and wait for a
reply at the xillybus_read_(8/32): this is done by manipulating the pipes, either from
Linux bash, or form a user custom-made app.
Nice thing is that Xillybus provides a set of APIs written in C, which not only
facilitate access to their bus interfaces, but also provide an efficient way to read from
and write to them.
To get started, open two terminal windows (pressing Ctrl+Alt+T twice) and
arrange them as you like. Consider theyll be used simultaneously later on.
5
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
For this test Linuxs cat utility will be used to read from and write to Xillybus
interfaces. First step is to start listening at the read bus. At the first terminal window
type in:
Figure 4: Opening the 8-bit synchronous read interface using linux command shell
As you may have now noticed, well be using the 8-bit bus interface for this
example. When you press <Enter> after writing the command above nothing should
happen, as nothing has been written to that interface yet.
Now lets proceed to write something to the same bus. Obviously, if youre trying
to read something from the 8-bit bus interface, youll also write to it, not to the 32-bit
one. To do so, type in the second linux terminal window (while the first is still open and
running the previous cat command) the following:
This will send everything that is typed with to the bus interface file.
6
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
Figure 5: Opening the 8-bit synchronous write interface using linux command shell
Now you can actually start sending data to the bus. Try writing something on the
second window, but youll notice nothing happens until you press <Enter>. This is
because of the way cat handles the input from keyboard, flushing data until you send de
command with the previously mentioned key.
7
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
Figure 6: Sharing data through the 8-bit write/read interface with cat command
Now, when youre done having fun transferring characters through the Xillybus,
you may close the channel by pressing Ctrl+C. Its important to notice that even if a
single character was typed and then the <Enter> key was pressed, it was immediately
shown up on the first terminal prompt. Figure 7 shows how everything should look like
after this process.
8
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
Now, open a new pair of terminals or simple use the command clear to clean the
command prompts. Well now proceed to make the same operation, but with the 32-bit
bus interface. Type in the first command prompt the following:
You may notice this is exactly the same test that was done before, but using the
32-bit bus interface. Its also important to notice that behavior is not exactly the same!
9
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
Figure 8: Opening the 32-bit asynchronous interface using linux command shell
Try typing some text down, and maybe it shall be happening the messages are
incomplete at the read side. A nice way to test this out is trying to send a single
character at a time: surprisingly it wont be immediately transferred. Well, there is an
explanation to this phenomenon: data is being transferred in 4-byte chunks (8*4 = 32),
and as every character is an 8-bit ASCII representation (dont forget <Enter> is also an
ASCII code), the data is flushed from the write FIFO every four characters. Some of this
single tests are shown on Figures 9 and 10.
10
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
Figure 9: Single characters are not immediately transferred through the 32-bit bus interface
Compare the first and the second command prompts, and notice the read
interface hasnt received everything that has previously been sent through the write bus
interface.
11
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
Figure 10: Just another test through the 32-bit bus interface: incomplete characters
Its important to stress this is not a bus malfunction, its simply the way data is
being shared between bus. This is why asynchronous 32-bit width bus interfaces are
intended to be used in streaming high-throughput operations, where pipelining latency is
not a concern to care about (at least, not that much).
Now that basic familiarization with the bus has been achieved, its time to get
hands into the included API functionalities provided by Xillybus. But before starting,
dont forget to close both pipes with Ctrl+C and open a set of new terminal prompts (or
just clean them with the clear command).
12
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
Before using the provided API examples, apps must be compiled with gcc.
Xillybus has been kindly enough to also provide a makefile to make things even easier.
root@localhost:~# cd xillybus/demoapps/
13
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
root@localhost:~# make
Now, clean the first terminal window and be prepared to start using the apps.
Well use the stream application included within the examples. Type into the first
terminal the following command:
root@localhost:~/xillybus/demoapps# ./streamread /dev/xillybus_read_8
14
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
Using this applications imply the usage of systems standard I/O (keyboard and
display through command prompt), but API functions can be tweaked to use alternative
sources and sinks instead, which is mostly the case.
You can start playing again with Xillybus, now using API functions, which lead to
a more efficient way to transfer data (for further details, please refer to Getting started
with Xillybus on a Linux host). Notice that each keystroke automatically generates a
data transfer operation to the bus.
Figure 13: Running the stream read/write applications on the 8-bit synchronous bus interface
15
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
Figure 14: Transferring data through the 8-bit bus interface using Xillybus C API
Next step is to test the same application, but using the 32-bit asynchronous bus
interface. As its expected, data transfers are done in 4 byte chunks to, so characters
will be flushed from output FIFO once the counter reaches 4 characters. To do so, close
the currently open pipes in both terminal prompts by pressing Ctrl + C. Now, type into
the first terminal the following command:
root@localhost:~/xillybus/demoapps# ./streamread /dev/xillybus_read_32
Further, open the write interface for the same bus with the application on the second
terminal prompt by typing:
root@localhost:~/xillybus/demoapps# ./streamwrite /dev/xillybus_write_32
16
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
Figure 15: Transferring data through the 32-bit bus interface using Xillybus C API
At this moment is easy to figure out why, even when data is automatically
transferred without pressing <Enter>, its not immediately sent until 4 bytes accumulate
in the output FIFO.
17
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
Figure 16: Using C API again with 32-bit bus interface. Data is grouped in 4-byte chunks
18
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
The Hello World! test is a ping test to Google. First, plug an ethernet cable from
the development boards RJ45 connector and wait until a connection is established, as
shown in Figure 17.
19
Ivn Ren Morales, Guatemala
Written for MLAB, ICTP
April, 2015
Replies from the server (similar to whats shown in Figure 18) should come out, if
so, youre done! You can even surf the Internet with a web browser, although this is not
the main task this hardware was intended for :)
Figure 18: Replies from an external host connected via ethernet interface
20