1 |
2 |
robotron |
--
|
2 |
|
|
-- PowerPC 405 APU FCM "timestamp"
|
3 |
|
|
-- record a time (counter value) of User Defined Instruction execution
|
4 |
|
|
--
|
5 |
|
|
-- idea by Pavel Pisa
|
6 |
|
|
-- written by Marek Peca 07/2008
|
7 |
|
|
-- KRT FEL CVUT http://dce.felk.cvut.cz/
|
8 |
|
|
--
|
9 |
|
|
|
10 |
|
|
The core is a fabric coprocessor module (FCM) for the PowerPC 405 CPU
|
11 |
|
|
providing code execution timestamp. It allows to measure precisely CPU
|
12 |
|
|
code execution times. A user-defined instruction (UDI) is provided by
|
13 |
|
|
the timestamp FCM, which records current time (32bit free running
|
14 |
|
|
counter) into the block RAM, which can be read later from the RAM,
|
15 |
|
|
mapped into ordinary CPU address space.
|
16 |
|
|
|
17 |
|
|
User code may execute a new instruction introduced by the FCM, udi0fcm,
|
18 |
|
|
with an optional argument (register), bearing so called tag. The current
|
19 |
|
|
counter time (ie. in CPU clocks) is stored at that specific instant into
|
20 |
|
|
the RAM, together with the tag. The tag can carry any value loadable to
|
21 |
|
|
a CPU register, eg. instruction pointer or an arbitrary number. Stored
|
22 |
|
|
values can be later dumped by a CPU from the RAM, and delays between
|
23 |
|
|
particular time stamps may be thus computed. The instruction execution
|
24 |
|
|
lasts 2 CPU cycles.
|
25 |
|
|
|
26 |
|
|
For more info and block diagram, see frescor_fpga.pdf, Sec. 3.1.
|
27 |
|
|
|
28 |
|
|
VHDL code of the timestamp FCM has been synthesized by Xilinx ISE 9.2i
|
29 |
|
|
and glued by Xilinx EDK 9.2i into Virtex-4 FPGA hardware containing
|
30 |
|
|
PowerPC 405 CPU. The FCM has been tested either running without an
|
31 |
|
|
operating system (using gcc 4.3.2 and proprietary Xilinx headers), as
|
32 |
|
|
well as under Linux 2.6.27-rc4, incorporating Xilinx PowerPC specific
|
33 |
|
|
patches and the attached patch (linux-2.6-fcm_udi_enable.diff), enabling
|
34 |
|
|
use of UDIs in user space.
|
35 |
|
|
|
36 |
|
|
File description:
|
37 |
|
|
|
38 |
|
|
system.mhs.example
|
39 |
|
|
example glue between timestamp and PPC (for EDK)
|
40 |
|
|
|
41 |
|
|
pcores/timestamp/data/timestamp.mpd
|
42 |
|
|
peripheral description for timestamp core (for EDK)
|
43 |
|
|
|
44 |
|
|
pcores/timestamp/hdl/vhdl/timestamp.vhdl
|
45 |
|
|
the actual timestamp core (using proprietary Xilinx 16Kb BRAM)
|
46 |
|
|
|
47 |
|
|
tstamp_linux/linux-2.6-fcm_udi_enable.diff
|
48 |
|
|
Linux kernel patch to enable udi0fcm instruction
|
49 |
|
|
|
50 |
|
|
tstamp_linux/tstamp_lnx.c
|
51 |
|
|
Linux userspace example code (gcc & Linux glibc)
|
52 |
|
|
|
53 |
|
|
tstamp_sysless/testapp_tstamp.c
|
54 |
|
|
operating system-less example code (gcc & Xilinx libs)
|
55 |
|
|
|
56 |
|
|
|
57 |
|
|
--
|
58 |
|
|
Greetings by Marek
|