OpenCores
URL https://opencores.org/ocsvn/socgen/socgen/trunk

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [regtool/] [gen_registers] - Diff between revs 134 and 135

Show entire file | Details | Blame | View Log

Rev 134 Rev 135
Line 1... Line 1...
eval 'exec `which perl` -S $0 ${1+"$@"}'
eval 'exec `which perl` -S $0 ${1+"$@"}'
   if 0;
   if 0;
 
#/****************************************************************************/
#/**********************************************************************/
 
#/*                                                                    */
 
#/*             -------                                                */
 
#/*            /   SOC  \                                              */
 
#/*           /    GEN   \                                             */
 
#/*          /    TOOL    \                                            */
 
#/*          ==============                                            */
 
#/*          |            |                                            */
 
#/*          |____________|                                            */
 
#/*                                                                    */
#/*                                                                    */
 
#/*   SOCGEN Design for Reuse toolset                                        */
#/*                                                                    */
#/*                                                                    */
 
#/*   Version 1.0.0                                                          */
#/*                                                                    */
#/*                                                                    */
#/*  Author(s):                                                        */
#/*  Author(s):                                                        */
#/*      - John Eaton, jt_eaton@opencores.org                          */
#/*      - John Eaton, z3qmtr45@gmail.com                                    */
#/*                                                                    */
#/*                                                                    */
#/**********************************************************************/
#/****************************************************************************/
#/*                                                                    */
#/*                                                                    */
#/*    Copyright (C) <2010-2011>                */
 
#/*                                                                    */
#/*                                                                    */
#/*  This source file may be used and distributed without              */
#/*             Copyright 2016 John T Eaton                                  */
#/*  restriction provided that this copyright statement is not         */
 
#/*  removed from the file and that any derivative work contains       */
 
#/*  the original copyright notice and the associated disclaimer.      */
 
#/*                                                                    */
 
#/*  This source file is free software; you can redistribute it        */
 
#/*  and/or modify it under the terms of the GNU Lesser General        */
 
#/*  Public License as published by the Free Software Foundation;      */
 
#/*  either version 2.1 of the License, or (at your option) any        */
 
#/*  later version.                                                    */
 
#/*                                                                    */
 
#/*  This source is distributed in the hope that it will be            */
 
#/*  useful, but WITHOUT ANY WARRANTY; without even the implied        */
 
#/*  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR           */
 
#/*  PURPOSE.  See the GNU Lesser General Public License for more      */
 
#/*  details.                                                          */
 
#/*                                                                    */
 
#/*  You should have received a copy of the GNU Lesser General         */
 
#/*  Public License along with this source; if not, download it        */
 
#/*  from http://www.opencores.org/lgpl.shtml                          */
 
#/*                                                                    */
#/*                                                                    */
#/**********************************************************************/
#/* Licensed under the Apache License, Version 2.0 (the "License");          */
 
#/* you may not use this file except in compliance with the License.         */
 
#/* You may obtain a copy of the License at                                  */
 
#/*                                                                          */
 
#/*    http://www.apache.org/licenses/LICENSE-2.0                            */
 
#/*                                                                          */
 
#/* Unless required by applicable law or agreed to in writing, software      */
 
#/* distributed under the License is distributed on an "AS IS" BASIS,        */
 
#/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
 
#/* See the License for the specific language governing permissions and      */
 
#/* limitations under the License.                                           */
 
#/*                                                                          */
 
#/*                                                                          */
 
#/****************************************************************************/
 
 
 
 
############################################################################
############################################################################
# General PERL config
# General PERL config
############################################################################
############################################################################
Line 182... Line 167...
 
 
 
 
 
 
my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version));
my $spirit_component_file    = $parser->parse_file(yp::lib::find_ipxact_component($vendor,$library,$component,$version));
 
 
   $name     = $spirit_component_file->findnodes('//spirit:component/spirit:name/text()')->to_literal ;
   $name     = $spirit_component_file->findnodes('//ipxact:component/ipxact:name/text()')->to_literal ;
   $version  = $spirit_component_file->findnodes('//spirit:component/spirit:version/text()')->to_literal ;
   $version  = $spirit_component_file->findnodes('//ipxact:component/ipxact:version/text()')->to_literal ;
   $vendor   = $spirit_component_file->findnodes('//spirit:component/spirit:vendor/text()')->to_literal ;
   $vendor   = $spirit_component_file->findnodes('//ipxact:component/ipxact:vendor/text()')->to_literal ;
   $library  = $spirit_component_file->findnodes('//spirit:component/spirit:library/text()')->to_literal ;
   $library  = $spirit_component_file->findnodes('//ipxact:component/ipxact:library/text()')->to_literal ;
 
 
foreach my $bus_iface ($spirit_component_file->findnodes("//spirit:busInterface[spirit:name/text() = '$bus_intf']/spirit:slave"))
foreach my $bus_iface ($spirit_component_file->findnodes("//ipxact:busInterface[ipxact:name/text() = '$bus_intf']/ipxact:slave"))
   {
   {
   $BI_name         = $bus_iface->findnodes('../spirit:name/text()')->to_literal ;
   $BI_name         = $bus_iface->findnodes('../ipxact:name/text()')->to_literal ;
   $BI_endian       = $bus_iface->findnodes('../spirit:endianness/text()')->to_literal ;
   $BI_endian       = $bus_iface->findnodes('../ipxact:endianness/text()')->to_literal ;
   $BI_width        = $bus_iface->findnodes('../spirit:bitsInLau/text()')->to_literal ;
   $BI_width        = $bus_iface->findnodes('../ipxact:bitsInLau/text()')->to_literal ;
   $BI_xname        = $bus_iface->findnodes('../spirit:abstractionType/@spirit:name')->to_literal ;
   $BI_xname        = $bus_iface->findnodes('../ipxact:abstractionTypes/ipxact:abstractionType/ipxact:abstractionRef/@name')->to_literal ;
   $memMap          = $bus_iface->findnodes('../spirit:slave/spirit:memoryMapRef/@spirit:memoryMapRef')->to_literal ;
   $memMap          = $bus_iface->findnodes('../ipxact:slave/ipxact:memoryMapRef/@ipxact:memoryMapRef')->to_literal ;
   }
   }
 
 
unless($BI_endian) {$BI_endian = "little";}
unless($BI_endian) {$BI_endian = "little";}
$byte_size         = int($BI_width) ;
$byte_size         = int($BI_width) ;
 
 
Line 205... Line 190...
 
 
 
 
 
 
 
 
 
 
foreach my $comp_view ($spirit_component_file->findnodes("//spirit:memoryMap[spirit:name/text() = '$memMap']"))
foreach my $comp_view ($spirit_component_file->findnodes("//ipxact:memoryMap[ipxact:name/text() = '$memMap']"))
   {
   {
   $memmap_name  = $comp_view->findnodes('./spirit:bank/spirit:name/text()')->to_literal ;
   $memmap_name  = $comp_view->findnodes('./ipxact:bank/ipxact:name/text()')->to_literal ;
   $memmap_base  = $comp_view->findnodes('./spirit:bank/spirit:baseAddress/text()')->to_literal ;
   $memmap_base  = $comp_view->findnodes('./ipxact:bank/ipxact:baseAddress/text()')->to_literal ;
   $memmap_size  = $comp_view->findnodes('./spirit:addressUnitBits/text()')->to_literal ;
   $memmap_size  = $comp_view->findnodes('./ipxact:addressUnitBits/text()')->to_literal ;
   $memmap_type  = $comp_view->findnodes('./spirit:bank/@spirit:bankAlignment')->to_literal ;
   $memmap_type  = $comp_view->findnodes('./ipxact:bank/@ipxact:bankAlignment')->to_literal ;
   $parmap_name  = $comp_view->findnodes('./spirit:name/text()')->to_literal ;
   $parmap_name  = $comp_view->findnodes('./ipxact:name/text()')->to_literal ;
 
 
 
 
 
 
   $memmap_numbase = hex($memmap_base);
   $memmap_numbase = hex($memmap_base);
 
 
Line 254... Line 239...
   }
   }
 
 
   print  OUTFILE sprintf(" /*********************************************/  \n");
   print  OUTFILE sprintf(" /*********************************************/  \n");
 
 
 
 
   foreach my $comp_view ($spirit_component_file->findnodes("//spirit:memoryMap[spirit:name/text() = '$memMap']/spirit:bank/spirit:addressBlock/spirit:name"))
   foreach my $comp_view ($spirit_component_file->findnodes("//ipxact:memoryMap[ipxact:name/text() = '$memMap']/ipxact:bank/ipxact:addressBlock/ipxact:name"))
   {
   {
   $addblk_name    = $comp_view->findnodes('../spirit:name/text()')->to_literal;
   $addblk_name    = $comp_view->findnodes('../ipxact:name/text()')->to_literal;
   $addblk_range   = $comp_view->findnodes('../spirit:range/text()')->to_literal;
   $addblk_range   = $comp_view->findnodes('../ipxact:range/text()')->to_literal;
   $addblk_width   = $comp_view->findnodes('../spirit:width/text()')->to_literal;
   $addblk_width   = $comp_view->findnodes('../ipxact:width/text()')->to_literal;
 
 
 
 
 
 
   $addblk_numrange = hex($addblk_range);
   $addblk_numrange = hex($addblk_range);
   $addblk_numaddbits = log($addblk_numrange)/log(2);
   $addblk_numaddbits = log($addblk_numrange)/log(2);
Line 283... Line 268...
   print  OUTFILE sprintf(" /* Byte_lanes:   %24s    */  \n",$sys_byte_lanes);
   print  OUTFILE sprintf(" /* Byte_lanes:   %24s    */  \n",$sys_byte_lanes);
   print  OUTFILE sprintf(" /* Byte_size:    %24s    */  \n",$byte_size);
   print  OUTFILE sprintf(" /* Byte_size:    %24s    */  \n",$byte_size);
   print  OUTFILE sprintf(" /*********************************************/  \n");
   print  OUTFILE sprintf(" /*********************************************/  \n");
 
 
 
 
   foreach my $reg_view ($spirit_component_file->findnodes("//spirit:memoryMap[spirit:name/text() = '$memMap']/spirit:bank/spirit:addressBlock[spirit:name/text() = '$addblk_name']/spirit:register/spirit:name "))
   foreach my $reg_view ($spirit_component_file->findnodes("//ipxact:memoryMap[ipxact:name/text() = '$memMap']/ipxact:bank/ipxact:addressBlock[ipxact:name/text() = '$addblk_name']/ipxact:register/ipxact:name "))
 
 
        {
        {
        $reg_name    = $reg_view->findnodes('./text()')->to_literal ;
        $reg_name    = $reg_view->findnodes('./text()')->to_literal ;
        $reg_offset  = $reg_view->findnodes('../spirit:addressOffset/text()')->to_literal ;
        $reg_offset  = $reg_view->findnodes('../ipxact:addressOffset/text()')->to_literal ;
        $reg_dim     = $reg_view->findnodes('../spirit:dim/text()')->to_literal ;
        $reg_dim     = $reg_view->findnodes('../ipxact:dim/text()')->to_literal ;
        $reg_size    = $reg_view->findnodes('../spirit:size/text()')->to_literal ;
        $reg_size    = $reg_view->findnodes('../ipxact:size/text()')->to_literal ;
        $reg_access  = $reg_view->findnodes('../spirit:access/text()')->to_literal ;
        $reg_access  = $reg_view->findnodes('../ipxact:access/text()')->to_literal ;
        $reg_numoffset = hex($reg_offset) + $memmap_numbase;
        $reg_numoffset = hex($reg_offset) + $memmap_numbase;
        unless($reg_dim) {$reg_dim     = "0x1" ;}
        unless($reg_dim) {$reg_dim     = "0x1" ;}
        $reg_numdim         = hex($reg_dim);
        $reg_numdim         = hex($reg_dim);
 
 
        if($reg_numdim > $max_dim )  {$max_dim = $reg_numdim;}
        if($reg_numdim > $max_dim )  {$max_dim = $reg_numdim;}

powered by: WebSVN 2.1.0

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