Hi all..
i have three input files as follows...
file1 is common_modify.vhd which has following lines of codes sum_1_SUM0_0 : XOR3 port map(A => b_c, B => a_c, C => c_c, Y => sum_c); a_pad : INBUF port map(PAD => a, Y => a_c); sum_1_CO0_i : MAJ3 port map(A => a_c, B => c_c, C => b_c, Y => N_5);
file2 is nets.txt which has following lines of codes a_c b_c c_c
file3 is enabled_nets.txt which has following lines of codes a_e b_e c_e
i want my perl script to search for a_c, b_c, c_c (file2) at inputs (A or B or C, not in Y) in common_modify.vhd file and replace them by a_, b_e, c_e (i.e. file3)...Here is the perl code i wrote, but it is not modifying as i want...
open (IN1, "<common_modify.vhd") or die; open (IN2, "<nets.txt") or die; open (IN3, "<enabled_nets.txt") or die; open (OUT, ">output_file.vhd") or die; my @nets = <IN2>; my @enabled_nets = <IN3>; while (<IN1>) { foreach $i (0..$#nets){ print OUT if (s/\=\>\s+$nets[$i]\,/\=\> $enabled_nets[$i]\,/); } }
my output file need to be as follows...
sum_1_SUM0_0 : XOR3 port map(A => b_e, B => a_e, C => c_e, Y => sum_c); a_pad : INBUF port map(PAD => a, Y => a_c); sum_1_CO0_i : MAJ3 port map(A => a_e, B => c_e, C => b_e, Y => N_5);
Please correct the mistakes in the code.. Thank you all for your patience to read my post.....
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |