OpenCores
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] - Blame information for rev 16

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 15 mgharish00
use strict;
2
use warnings;
3
 
4
print "Enter the Number of Rungs :\n";
5
my $rung_num = <>;
6
chomp($rung_num);
7
 
8
my (@inp_array, @out_array, @inst_array);
9 16 aravindhk
@inp_array = ('I0', 'I1', 'I2', 'I3', 'I4', 'I5', 'I6');
10
@out_array = ('O0', 'O1', 'O2', 'O3', 'O4', 'O5', 'O6');
11
@inst_array = ('LD', 'ST', 'AND', 'OR', 'N');
12 15 mgharish00
 
13
#Loop for Creating Instructions in a rung
14
open my $file_out, ">", "PLC_instruction.txt";
15
 
16
for (my $i = 1; $i <= $rung_num ; $i++)
17
{
18
my $instr_num = int(rand(10)) + 1;
19
 
20
  for (my $j = 1; $j <= $instr_num; $j++)
21
  {
22
  #print {$file_out} $i,".",$j, " ";
23
    if ($j == 1)
24
    {
25
    print {$file_out} $inst_array[0], " ";
26
    print {$file_out} $inp_array[int(rand(6))], "\n";
27
    }
28
        elsif ($j == $rung_num)
29
        {
30
        print {$file_out} $inst_array[1], " ";
31
    print {$file_out} $out_array[int(rand(6))], "\n";
32
        }
33
        else
34
        {
35
        print {$file_out} $inst_array[int(rand(3))+1], " ";
36
    print {$file_out} $inp_array[int(rand(6))], "\n";
37
        }
38
  }
39 16 aravindhk
print {$file_out} "ENDOFRUNG", "\n";
40 15 mgharish00
#print {$file_out} "\n";
41
}
42
close($file_out);
43
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.