mirror of
https://github.com/aolofsson/oh.git
synced 2025-01-17 20:02:53 +08:00
Adding a utility for generating emesh transactions
This commit is contained in:
parent
9ada08a42c
commit
547bf9751f
3
emesh/dv/README
Normal file
3
emesh/dv/README
Normal file
@ -0,0 +1,3 @@
|
||||
|
||||
The egen.pl is a dumb transaction generator for the emesh packet transactions.
|
||||
./egen.pl -da "0x8e0800000" -sa "0x80800000" -d "0xABCD0000" -c 06 -n 64 > reads
|
72
emesh/dv/egen.pl
Executable file
72
emesh/dv/egen.pl
Executable file
@ -0,0 +1,72 @@
|
||||
#! /usr/bin/perl
|
||||
use Getopt::Long;
|
||||
$Usage =<<EOF;
|
||||
#######################################################
|
||||
Usage: egen.pl -da <dstaddr>
|
||||
-sa <srcaddr>
|
||||
-d <data>
|
||||
-c <ctrlmode>
|
||||
-n <numoftrans>
|
||||
|
||||
Description: Generates a list of emesh packets
|
||||
#######################################################
|
||||
|
||||
EOF
|
||||
$result = GetOptions('da:s','sa:s','d:s','c:s', 'n:s' );
|
||||
|
||||
if (
|
||||
(!defined $opt_c))
|
||||
{
|
||||
printf $Usage;
|
||||
exit;
|
||||
}
|
||||
|
||||
$dstaddr=hex($opt_da);
|
||||
$srcaddr=hex($opt_sa);
|
||||
$data=hex($opt_d);
|
||||
$ctrlmode=$opt_c;
|
||||
$n=$opt_n;
|
||||
|
||||
if($ctrlmode%2){
|
||||
$op="write";
|
||||
}
|
||||
else{
|
||||
$op="read";
|
||||
}
|
||||
|
||||
if($ctrlmode < 2){
|
||||
$incr=1;
|
||||
$size=byte;
|
||||
|
||||
}
|
||||
elsif($ctrlmode < 4){
|
||||
$incr=2;
|
||||
$size=halword;
|
||||
}
|
||||
elsif($ctrlmode < 6){
|
||||
$incr=4;
|
||||
$size=word;
|
||||
}
|
||||
elsif($ctrlmode < 8){
|
||||
$incr=8;
|
||||
$size=double;
|
||||
}
|
||||
|
||||
for($i=0;$i<$n;$i++){
|
||||
printf("%08x_%08x_%08x_%02x_0000 // $op $size \n", $srcaddr,
|
||||
$dstaddr,
|
||||
$data,
|
||||
$ctrlmode,
|
||||
$op,
|
||||
$size);
|
||||
$srcaddr=$srcaddr+$incr;
|
||||
$dstaddr=$dstaddr+$incr;
|
||||
$data =$data+$incr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#############################################################################
|
||||
# Author: Andreas Olofsson
|
||||
# Date: Nov 11, 2015
|
||||
##############################################################################
|
Loading…
x
Reference in New Issue
Block a user