All signals are recorded in one hierarchy named 'SystemC' in VCD generated by SystemC simulator even though VCD can describe hierarchy.
Just modifying the header of VCD is sufficient to set hierarchy structure. The easiest way is to write such script in Ruby or Python. I once wrote such script but it was slow for a large VCD file.
It had to read and write the main part of VCD even the header is need to be modified.
I wrote a small program to manipulate VCD very quickly. Mapping a file to memory is key point to get a good performance. If the file size does not change, head of file can be modified and only the modified portion is written.
It is available at github.
It might have been easy if I used std::string, but I used string_view class to avoid copying strings for future program.
2013年4月28日日曜日
2013年4月7日日曜日
How to hook the memory access in TLMu
In my fork of TLMu, SystemC world is mapped as a tlmu_ramd in QEMU. tlmu_ramd is similar to romd in QEMU, but accepts both read and write requets. romd is a kind of device in QEMU to model Flash memory devices. Flash memory devices require special sequece to erase and write, and romd provides memory access functions to model such operations. Without such functions, QEMU accesses memory regions with direct a memory pointer.
TLM2.0 provides direct memory interface (DMI) but special sequeice is necessary to get memory pointers. So romd is good abstraction scheme for TLMu, but it allows only write hooks. So I add tlmu_ramd which provides both read and write hook functions.
Detailed modifications can be seen at the commit.
QEMU and TLM2.0 provides debug memory access method. To meet them I make memory access function pointer as array in tlm_mem.c:320. Operations are switched at line 1884 and 1953 of exec.c.
TLM2.0 provides direct memory interface (DMI) but special sequeice is necessary to get memory pointers. So romd is good abstraction scheme for TLMu, but it allows only write hooks. So I add tlmu_ramd which provides both read and write hook functions.
Detailed modifications can be seen at the commit.
QEMU and TLM2.0 provides debug memory access method. To meet them I make memory access function pointer as array in tlm_mem.c:320. Operations are switched at line 1884 and 1953 of exec.c.
2013年3月13日水曜日
Installing Munin on gentoo and CentOS
Munin, which is a software to monitor the servers requires less effort to setup than MRTG.
I setup Munin server on gentoo box and munin-node on centos boxes.
Munin server collects status from munin-nodes and generates charts.
Before installing munin, it is better to serup httpd like apache, lighttpd.
If you have already installed httpd, simple emerge it, but you cannot use -minimal flag.
Then edit the /etc/munin/munin.conf and add following entry if not exists.
On CentOS 5.x x86_64
I setup Munin server on gentoo box and munin-node on centos boxes.
Munin server collects status from munin-nodes and generates charts.
Setup Munin server on gentoo
Article in gentoo wiki is helpful.Before installing munin, it is better to serup httpd like apache, lighttpd.
If you have already installed httpd, simple emerge it, but you cannot use -minimal flag.
# emerge -v munin
# emerge --config net-analyzer/munin
If you also want to monitor this box, it should also be munin-node.# rc-update add munin-node default
# /etc/init.d/munin-node
Then edit the /etc/munin/munin.conf and add following entry if not exists.
[yourserver.example.com]emerge --config commands installs crontab, so you will find newly generated charts within 5 minutes at /var/www/localhost/htdocs/munin/.
address 127.0.0.1
use_node_name yes
Setup Munin-node on centos
Enable EPEL
Because munin is not hosted in the default repository, you have to enable EPEL (Extra Packages for Enterprise Linux).On CentOS 5.x x86_64
# rpm -ivh http://ftp-srv2.kddilabs.jp/Linux/distributions/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm
On CentOS 6.x x86_64
# rpn -ivh http://ftp-srv2.kddilabs.jp/Linux/distributions/fedora/epel/6/x86_64/epel-release-6-5.noarch.rpm
Then edit/etc/yum.repos.d/epel-testing.repo and set enable of [epel-testing].enabled=1
Install munin-node
Just yum it.# yum install munin-nodeEdit /etc/munin/munin-node.conf and add allow entry for Munin server. Note that the IP address must be described as a regular expression.
allow ^192\.168\.0\.\d+$Then boot munin-node and make it executed automatically.
# /etc/init.d/munin-node start
# chkconfig --add munin-node
# chkconfig munin-node on
Add munin-node to be monitored
Edit /etc/munin/munin.conf on gentoo box and add an entry of centos box.[centos.example.com]Now you can check the status at http://gentoobox.example.com/munin/.
address 192.168.0.2
use_node_name yes
2013年3月7日木曜日
802.1X PEAP-md5 authentification with freeradius
A few wireless access point supports WPA2-EAP, each user can have different password to connect wifi with it.
Some model of corega supports WPA2-EAP, you have to check the datasheet before you buy.
RADIUS server, which manages accounts is necessary for EAP auth.
I realized WPA2-EAP wifi access point with freeradius on gentoo linux.
Following is the procedure of it.
Add an entry like following.
The following 3 lines are required for each account.
You have to specify at least 2 information below.
You will have to enter the account name and password as in /etc/radvd/users.
I tested with 4 clients, windows8 pro, android 2.3, android 4.0 and android 4.2. Only android 2.3 failed to connect. I am not sure the reason.
Some model of corega supports WPA2-EAP, you have to check the datasheet before you buy.
RADIUS server, which manages accounts is necessary for EAP auth.
I realized WPA2-EAP wifi access point with freeradius on gentoo linux.
Following is the procedure of it.
Install freeradius
Simply emerge it.# emerge freeradius -v
Setup the config files
Edit /etc/raddb/clients.conf to allow clients(access point) to query the account.Add an entry like following.
client 192.168.0.0/24 {
secret = secretphrase
shortname = yourservername
}
Make account
Edit /etc/raddb/users to add accounts.The following 3 lines are required for each account.
account_name Cleartext-Password := "password"
Service-Type = Framed-User,
Framed-Protocol = PPP
Setup access point
Setup the access point to use WPA2-EAP auth.You have to specify at least 2 information below.
- IP address or hostname of radius server
- secret key specified in clients.conf
Start daemon with debug mode
# radiusd -XIf you try to connect the access point, access point queries the radius server and radiusd will show the debug messages.
You will have to enter the account name and password as in /etc/radvd/users.
I tested with 4 clients, windows8 pro, android 2.3, android 4.0 and android 4.2. Only android 2.3 failed to connect. I am not sure the reason.
Let radiusd starts at boot time
# rc-update add radiusd default
What is TLMu?
TLMu, which is originaly written by Edgar Iglesias is a software based on QEMU.
QEMU is a emulator which supports various kinds of architectures like x86, arm, ppc, mips, xtensa and so on.
TLMu lets you connect CPU core in QEMU to SystemC models.
TLMu hooks memory access from CPU core and redirect to TLM-2.0 access.
CPU core in QEMU can access SystemC world and vice versa.
Edgar seemed to focus on cris and I found several problems on arm and mips.
I had fixed them and Edgar accepted my patches.
After the modifications, I managed to boot the latest Linux kernel (3.4) on TLMu + SystemC peripheral environment. Whole environment is available at here.
Edgar's original TLMu is based on relatively older QEMU (maybe around 1.0).
I wanted to catch up with the mainline QEMU release, so I forked and rebased onto the QEMU-1.2.0.
The internal of QEMU has greatly changed between 1.0 and 1.2, so I had to rewrite the most part of memory access hooks. As a byproduct of the rewrite, I add turbo mode, in which Linux boot time is 7x accelerated.
My TLMu branch keeps up with the mainline QEMU and has original features like OpenRISC support, turbo mode now.
I will explain the memory access hooks and turbo mode in the next post.
QEMU is a emulator which supports various kinds of architectures like x86, arm, ppc, mips, xtensa and so on.
TLMu lets you connect CPU core in QEMU to SystemC models.
TLMu hooks memory access from CPU core and redirect to TLM-2.0 access.
CPU core in QEMU can access SystemC world and vice versa.
Edgar seemed to focus on cris and I found several problems on arm and mips.
I had fixed them and Edgar accepted my patches.
After the modifications, I managed to boot the latest Linux kernel (3.4) on TLMu + SystemC peripheral environment. Whole environment is available at here.
Edgar's original TLMu is based on relatively older QEMU (maybe around 1.0).
I wanted to catch up with the mainline QEMU release, so I forked and rebased onto the QEMU-1.2.0.
The internal of QEMU has greatly changed between 1.0 and 1.2, so I had to rewrite the most part of memory access hooks. As a byproduct of the rewrite, I add turbo mode, in which Linux boot time is 7x accelerated.
My TLMu branch keeps up with the mainline QEMU and has original features like OpenRISC support, turbo mode now.
I will explain the memory access hooks and turbo mode in the next post.
2013年2月25日月曜日
SCV for x86_64 linux patch
I made a patch for scv to be compiled on x86_64 linux platform.
I posted it to SystemC Japan BBS.
You can apply the patch with the following procedure.
- Save the text below (from BEGIN to END, exlucde these 2 lines) to scv_x86_64.patch.base64
- tar scv-1.0p2-sysc2.2.12jun06.tgz
- cd scv-1.0p2-sysc2.2/
- cat scv_x86_64.patch.base64 | base64 -d --ignore | gunzip | patch -p0
- aclocal --force
- autoheader --force
- automake --force-missing --add-missing --copy
- autoconf --force
- ./configure --with-systemc=$SYSTEMC_HOME --prefix=$SYSTEMC_HOME
- make
- make install
If you find any problems, please let me know.
--BEGIN
H4sIAAtwok0AA70Za1ubTPaz/opTal9DgQjkYoxNn6qJNruauIn2tev6UIRJwlsCLJCa1vW/75nh
EiCJl7a7edqQOXPutzmDkiRBeScwfMsLg50z/SsZWTYp69Oy61vjDVWWK5LcwH8gy81KoymrZTn5
gCDvyfKmIAirWSC1okhylVIrlaZabarKEvWHDyBVVVHFdfT48GETNkG3bWjSb0mfguETPSSa4XoW
8QPcFl7HMEDY97bll4NJAdiZ61PPJsHyzrG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XIpT5Xa2Jiop+j57RgRbzYY0ItbhW5Ez/ackijHQc5M2WzKB3E1yU
UnHWTZmqx8eZlXQU5IMdheK8MTkxbk40J5LaYwhLXKJ6AkGIRObzcz1vIeW9KNdnCohSVRDirGcN
ohRt8hgGmttAiyLai5Zy0hcziGklJNjZ6oAXlEd0nga+sWPMTHNHLVfK8s4stGz2VZ6sPF13m7V1
L+jWc8qdtbVmFZnsrXtdXWdvq5XoxdlrVD8+0C4vuqfaZQ9HqTbCiWNaI/a62hqxUez0vF5lKzaZ
0VbeP9Y+9btt7RzByaGYBUMDNyI+Rbpu72KJCGFQXUtx2u+dLJFQYFYK/UUHRFitJqxWs5qaSz1U
U6iH6pX4deYqNYp8mBoLLkLqPEpdENZqQQP++CNrNIKQmN5bqCDbxYOCRlXzaNsJ9zNphFcz+l9j
HcXHmQSbo+etSaPK2j93rOVUSKOajJm0Mo3UhloXFfRT8iNqPwR7PV6z/iTWeBL2XJOUeoRWS3Kc
9UJatK5D6B71QgT4QXyXQvj0VPNo/Rz6umNMkKXn3pVKpju7tQmviqUjLAFtQMYzW/eRJS+9tzBE
c5Agt+NQjos9hefhLYRxh3lMADrjV2XQBsTuKonZrdRs/lk2OrPpoWl+wjb+O616MdeFHfdRq8tL
CGExYTBDSTG+JB/fxHTKMuXyeHzJi3xP8IoW++IxGcsh/gkxhSCTlUHOafFLQSYrDfvVIJNVQc5J
IEmQl/sQmXs+YX+1yvWhmqTIklqhf29SdpvKusviek7FPlRrKvLKPlTBS+MuCNEjudMHhnb7Tbul
f2vAU7lEyvTNz60VaneWGU5KPJ/c6tkGosxICb8TMH29WYoHJpzR4B3lUg6sH6SE0wDOF3RGiIfv
dEgKp158X8F55o1tvgnw0kXpqAic282SxYuQYvGwmIce41CipwH/OB/G5SF6+CSc0Wkx2Y8j91+X
dgpUKh8AAA==
--END
2013年2月19日火曜日
TLMu-1.4.0 is released
I have rebased the tlmu-1.4.0_work branch and renamed it tlmu-1.4.0. I will not rebase it.
It is available at github.
You can try it with the following procedure.
1) Get the package
% git clone https://github.com/yTakatsukasa/tlmu
2) Build
run in the directory tlmu.
% mkdir build
% cd build
% ../configure --extra-cflags=-fPIC --disable-pie --disable-curses --disable-sdl --disable-vnc --disable-xen --disable-kvm --target-list=or32-softmmu,arm-softmmu,mipsel-softmmu,cris-softmmu
% make
% make tlmu
% make -C tests/tlmu install-tlmu
% cd tests/tlmu/
% make
% env LD_LIBRARY_PATH=./lib:$LD_LIBRARY_PATH ./c_example
Then you will see the Hello world message from arm, cris, mips and openrisc.
It is available at github.
You can try it with the following procedure.
1) Get the package
% git clone https://github.com/yTakatsukasa/tlmu
2) Build
run in the directory tlmu.
% mkdir build
% cd build
% ../configure --extra-cflags=-fPIC --disable-pie --disable-curses --disable-sdl --disable-vnc --disable-xen --disable-kvm --target-list=or32-softmmu,arm-softmmu,mipsel-softmmu,cris-softmmu
% make
% make tlmu
% make -C tests/tlmu install-tlmu
% cd tests/tlmu/
% make
% env LD_LIBRARY_PATH=./lib:$LD_LIBRARY_PATH ./c_example
Then you will see the Hello world message from arm, cris, mips and openrisc.
登録:
投稿 (Atom)