Hi I am having a code as stated below
module abcd( a , b , c ,da , fa, na , ta , ma , ra ,
ta, la , pa );
input a , b, da ,fa , na , ta , ma;
output c , ra ,ta ,
la ,pa ;
wire a , b , da , fa ,na ,
ta , ma;
endmodule
I need to match the string between "input" and ";" create a list similarly need to match the string between "output" and ";" create a list
My Input list should be
a , b, da , fa ,na , ta , ma
Output list should be
c , ra ,ta ,la , pa
I have tried below code but not getting the desired outcome
set chan [open "mod1.v"]
set out [open "output.file.txt" "w"]
set lineNumber 0
# Read until we find the start pattern
while {[gets $chan line] >= 0} {
incr lineNumber
puts $line
if { [string match "input" $line]} {
# Now read until we find the stop pattern
while {[gets $chan line] >= 0} {
incr lineNumber
if { [string match ";" $line] } {
close $out
break
} else {
puts $out $line
}
}
}
}
close $chan
Expected results
My Input list should be
a , b, da , fa ,na , ta , ma
Output list should be
c , ra ,ta ,la , pa