bsp2arch.pl: add host processor, emem size to xml
authorSebastian <basti@sraa.de>
Mon, 2 Sep 2013 20:59:57 +0000 (22:59 +0200)
committerSebastian <basti@sraa.de>
Mon, 2 Sep 2013 20:59:57 +0000 (22:59 +0200)
hdf2arch/bsp2arch.pl

index 6e80ed066ff520a30b3b08796297ffabc8048750..986b2cf458a8e0ac11c626d8da4be78f00f023f2 100755 (executable)
@@ -19,14 +19,17 @@ if(!$infile || !$outfile) {
 # parse input xml file
 my $input = XMLin($infile, ForceArray => '1', KeyAttr => ['chips']);
 
-
-# per-core definitions
+# output content
 my @processors;
 my @memories;
+my @hw_channels;
+
+# per-core definitions
 foreach my $chips ($input->{'chips'}->[0]->{'chip'}) {
        foreach my $chip (@$chips) {
                $chip->{'id'} =~ /\((\d+),(\d+)\)/;
-               my @origin = ($1, $2);
+               my @origin    = ($1, $2);
+               my $version   = $chip->{'version'};
 
                foreach my $row (1..$chip->{'rows'}) {
                        foreach my $col (1..$chip->{'cols'}) {
@@ -41,7 +44,7 @@ foreach my $chips ($input->{'chips'}->[0]->{'chip'}) {
                                        'type' => 'RISC',
                                        'configuration' => [
                                                { 'name'  => 'version',
-                                                 'value' => '3' },
+                                                 'value' => $version },
                                        ],
                                };
 
@@ -59,13 +62,26 @@ foreach my $chips ($input->{'chips'}->[0]->{'chip'}) {
                                push @memories, {
                                        'name' => "regs_${newrow}_${newcol}",
                                        'type' => 'REG',
+                                       'configuration' => [
+                                               { 'name'  => 'size',
+                                                 'value' => '0x7FF' },
+                                       ],
                                }
                        }
                }
-
        }
 }
 
+# ARM host processor
+push @processors, {
+       'name' => 'arm_0',
+       'type' => 'RISC',
+       'configuration' => [
+               { 'name'  => 'cores',
+                 'value' => '2' },
+       ]
+};
+
 # external memory
 foreach my $banks ($input->{'external_memory'}->[0]->{'bank'}) {
        my $counter = 0;
@@ -77,6 +93,12 @@ foreach my $banks ($input->{'external_memory'}->[0]->{'bank'}) {
                        push @memories, {
                                'name' => "emem_${counter}",
                                'type' => 'DXM',
+                               'configuration' => [
+                                       { 'name'  => 'size',
+                                         'value' => $bank->{'size'} },
+                                       { 'name'  => 'start',
+                                         'value' => $bank->{'start'} }
+                               ]
                        };
                        next;
                        say "Warning: Unknown Extmem $bank->{'name'}!";
@@ -85,7 +107,6 @@ foreach my $banks ($input->{'external_memory'}->[0]->{'bank'}) {
 }
 
 # TODO: add hw_channels data
-my @hw_channels;
 
 # generate XML output
 my $output = {