Monday, 26 August 2013

perl programming to store column value based on another column value

perl programming to store column value based on another column value

i have an input in text file like :
Time(1ps) *_sysclock *hy_dvdd_0 *y_vdd18_0 *s_enabled *lpi_clk_0
========== ========== ========== ========== ========== ==========
1000000000 1 1 1 11 1
1000000045 1 1 1 11 0
1000008365 1 1 1 11 1
1000009824 0 1 1 11 1
1000016685 0 1 1 11 0
1000025005 0 1 1 11 1
1000033325 0 1 1 11 0
1000035828 1 1 1 11 0
1000041645 1 1 1 11 1
1000049965 1 1 1 11 0
1000058285 1 1 1 11 1
1000061832 0 1 1 11 1
1000066605 0 1 1 11 0
What i have to do here is : 2nd column indicate the clock edge and first
column indicate the time.. I need to measure the clock frequency. so what
my requirement is, since this script is taking the first value as depend
on the time when i run the script, so when clock value changes from
initial value, in the above example initial value is 1, so when it changes
to 0, that time i want to store the column 1 value in one variable and
when again clock value changes to 1 that time i want to store the column 1
value to get the clock pulse duration.
based on that i want to compare these timing difference with some
predefined value to compare it.
can you experts help me in solving this.
thanks all in advance.
Expected O/P is : I need the output which tells me the difference between
the edges.. like in the above example : diff between "1000009824" where
the first changes in the clock edge occurs. and "1000061832" where the
clock edge value again comes a 0, means a full clock cycle.

No comments:

Post a Comment