URL
https://opencores.org/ocsvn/instruction_list_pipelined_processor_with_peripherals/instruction_list_pipelined_processor_with_peripherals/trunk
Subversion Repositories instruction_list_pipelined_processor_with_peripherals
[/] [instruction_list_pipelined_processor_with_peripherals/] [trunk/] [architecture/] [input_script.pl] - Rev 15
Go to most recent revision | Compare with Previous | Blame | View Log
use strict; use warnings; print "Enter the Number of Rungs :\n"; my $rung_num = <>; chomp($rung_num); my (@inp_array, @out_array, @inst_array); @inp_array = ('10', '11', '12', '13', '14', '15', '16'); @out_array = ('20', '21', '22', '23', '24', '25', 'O6'); @inst_array = ('1', '2', '3', '4', '5'); #Loop for Creating Instructions in a rung open my $file_out, ">", "PLC_instruction.txt"; for (my $i = 1; $i <= $rung_num ; $i++) { my $instr_num = int(rand(10)) + 1; for (my $j = 1; $j <= $instr_num; $j++) { #print {$file_out} $i,".",$j, " "; if ($j == 1) { print {$file_out} $inst_array[0], " "; print {$file_out} $inp_array[int(rand(6))], "\n"; } elsif ($j == $rung_num) { print {$file_out} $inst_array[1], " "; print {$file_out} $out_array[int(rand(6))], "\n"; } else { print {$file_out} $inst_array[int(rand(3))+1], " "; print {$file_out} $inp_array[int(rand(6))], "\n"; } } print {$file_out} "5555 5555", "\n"; #print {$file_out} "\n"; } close($file_out);
Go to most recent revision | Compare with Previous | Blame | View Log