LOGIN   :::   RECOVER PASS   :::   GET ACCOUNT    
Browse
  • Projects
  • Code (CVS)
  • Forums
  • News
  • Articles
  • Polls
  •  
    OpenCores
  • FAQ
  • CVS HowTo
  • Mission
  • Media
  • Tools
  • Advertise
  • Mirrors
  • Logos
  • Contact us
  • Job Opportunity
  •  
    Tools
  • Search
      
  • Download Cores (CVSGet)
  •  
    More
  • Wishbone
  • Perlilog
  • EDA tools
  • OpenTech CD
  •  
    Navigation: All forums > Cvs-checkins > Message List > Message Post

    Message

    Reply | Reply all
    Date Prev | Date Next | Thread Prev | Thread Next Date Index | Thread Index

    From: cvs at opencores.org<cvs@o...>
    Date: Sun Feb 24 21:19:13 CET 2008
    Subject: [cvs-checkins] MODIFIED: jop ...
    Top
    Date: 00/08/02 24:21:19

    Modified: jop/java/tools/src/joptimizer/config ArchConfig.java
    Added: jop/java/tools/src/joptimizer/config ArchTiming.java
    JopTimings.java
    Log:
    added timing infos, added better gain calculation and some heuristics


    Revision Changes Path
    1.2 jop/java/tools/src/joptimizer/config/ArchConfig.java

    http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/joptimizer/config/ArchConfig.java.diff?r1=1.1&r2=1.2

    (In the diff below, changes in quantity of whitespace are not shown.)

    Index: ArchConfig.java
    ===================================================================
    RCS file: /cvsroot/stefant/jop/java/tools/src/joptimizer/config/ArchConfig.java,v
    retrieving revision 1.1
    retrieving revision 1.2
    diff -u -b -r1.1 -r1.2
    --- ArchConfig.java 13 Jan 2008 20:43:53 -0000 1.1
    +++ ArchConfig.java 24 Feb 2008 20:19:12 -0000 1.2
    @@ -18,16 +18,22 @@
    */
    package joptimizer.config;

    -import java.util.Set;
    import java.util.HashSet;
    +import java.util.Set;

    /**
    * @author Stefan Hepp, e0026640@s...
    */
    public class ArchConfig {

    + private ArchTiming timing;
    +
    public ArchConfig(String filename) {
    + timing = new JopTimings(this);
    + }

    + public ArchTiming getArchTiming() {
    + return timing;
    }

    public String getNativeClassName() {
    @@ -75,4 +81,12 @@
    public int getMaxStackSize() {
    return 31;
    }
    +
    + public int getRamReadCycles() {
    + return 2;
    + }
    +
    + public int getRamWriteCycles() {
    + return 2;
    + }
    }



    1.1 jop/java/tools/src/joptimizer/config/ArchTiming.java

    http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/joptimizer/config/ArchTiming.java?rev=1.1&content-type=text/x-cvsweb-markup

    Index: ArchTiming.java
    ===================================================================
    /*
    * Copyright (c) 2007,2008, Stefan Hepp
    *
    * This file is part of JOPtimizer.
    *
    * JOPtimizer is free software; you can redistribute it and/or modify
    * it under the terms of the GNU General Public License as published by
    * the Free Software Foundation; either version 3 of the License, or
    * (at your option) any later version.
    *
    * JOPtimizer 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 General Public License for more details.
    *
    * You should have received a copy of the GNU General Public License
    * along with this program. If not, see <http://www.gnu.org/licenses/>.
    */
    package joptimizer.config;

    import com.jopdesign.libgraph.cfg.statements.stack.StackInvoke;
    import com.jopdesign.libgraph.cfg.statements.stack.StackReturn;
    import com.jopdesign.libgraph.cfg.statements.stack.StackStatement;

    /**
    * Interface for timing calculation implementations (architecture/configuration-dependent).
    *
    * @author Stefan Hepp, e0026640@s...
    */
    public interface ArchTiming {

    /**
    * Get number of cycles needed for this statement. For invokes and returns this does not * include the time to initialize the method cache. * * @param stmt any stackstatement. * @return the number of cycles needed for the statement, 0 if the statement has no Opcode. */ int getCycles(StackStatement stmt); int getInvokeCycles(StackInvoke stmt, int methodSize, boolean cacheMiss); int getReturnCycles(StackReturn stmt, int methodSize, boolean cacheMiss); /** * Get the cycles needed to load a given number of bytes into the method cache. * This does not include any initialization or additional data, this is handled by * {@link #getInvokeCycles(com.jopdesign.libgraph.cfg.statements.stack.StackInvoke, int, boolean)}. * * @param bytes the number of bytes to load. * @return the cycles needed to load the bytes into the cache. */ int getCacheMemCycles(int bytes); } 1.1 jop/java/tools/src/joptimizer/config/JopTimings.java http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/joptimizer/config/JopTimings.java?rev=1.1&content-type=text/x-cvsweb-markup Index: JopTimings.java =================================================================== /* * Copyright (c) 2007,2008, Stefan Hepp * * This file is part of JOPtimizer. * * JOPtimizer is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * JOPtimizer 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package joptimizer.config; import com.jopdesign.libgraph.cfg.statements.common.InvokeStmt; import com.jopdesign.libgraph.cfg.statements.stack.StackIfCmp; import com.jopdesign.libgraph.cfg.statements.stack.StackIfZero; import com.jopdesign.libgraph.cfg.statements.stack.StackInvoke; import com.jopdesign.libgraph.cfg.statements.stack.StackReturn; import com.jopdesign.libgraph.cfg.statements.stack.StackStatement; /** * Timings for Jop architecture. * * TODO maybe make generic by simulating microcode/javacode, or more configs.. * * @author Stefan Hepp, e0026640@s... */ public class JopTimings implements ArchTiming { private ArchConfig config; public JopTimings(ArchConfig config) { this.config = config; } public int getCycles(StackStatement stmt) { int cycles = 0; int r = getReadCycles(); // TODO implement other statements, what do do about java-impl of statements? simulate? WCET? // some simple instructions: switch ( stmt.getOpcode() ) { case 0: return 1; // NOP case 167: return 4; // GOTO } if ( stmt instanceof StackIfCmp ) { return 4; } if ( stmt instanceof StackIfZero ) { return 4; } if ( stmt instanceof StackInvoke ) { StackInvoke invoke = (StackInvoke) stmt; switch (invoke.getInvokeType()) { case InvokeStmt.TYPE_VIRTUAL: cycles = 100 + 2*r + ( r > 3 ? r - 3 : 0 ) + ( r > 2 ? r - 2 : 0 ); break; case InvokeStmt.TYPE_SPECIAL: case InvokeStmt.TYPE_STATIC: cycles = 74 + r + ( r > 3 ? r - 3 : 0 ) + ( r > 2 ? r - 2 : 0 ); break; case InvokeStmt.TYPE_INTERFACE: cycles = 114 + 4*r + ( r > 3 ? r - 3 : 0 ) + ( r > 2 ? r - 2 : 0 ); break; } } else if ( stmt instanceof StackReturn ) { StackReturn ret = (StackReturn) stmt; int length = ret.getType() != null ? ret.getType().getLength() : 0; cycles = 21 + 2*length + ( r > 3 ? r - 3 : 0 ); } return cycles; } public int getInvokeCycles(StackInvoke stmt, int methodSize, boolean cacheMiss) { int cycles = getCycles(stmt); int load = getCacheLoadCycles(methodSize, cacheMiss); cycles += load > 37 ? load - 37 : 0; return cycles; } public int getReturnCycles(StackReturn stmt, int methodSize, boolean cacheMiss) { int cycles = getCycles(stmt); int load = getCacheLoadCycles(methodSize, cacheMiss); int length = stmt.getType() != null ? stmt.getType().getLength() : 0; cycles += load > 9 + length ? load - 9 - length : 0; return cycles; } public int getCacheMemCycles(int bytes) { int rws = getReadCycles(); int cw = rws > 1 ? rws - 1 : 0; return ((bytes + 3)/4) * (2 + cw); } private int getCacheLoadCycles(int methodSize, boolean cacheMiss) { int load; if ( cacheMiss ) { load = 6 + getCacheMemCycles(methodSize + 4); } else { load = 4; } return load; } private int getReadCycles() { int ram_cnt = config.getRamReadCycles(); return ram_cnt > 1 ? ram_cnt - 1 : 0; } private int getWriteCycles() { int ram_cnt = config.getRamWriteCycles(); return ram_cnt > 1 ? ram_cnt - 1 : 0; } }

     
    Copyright (c) 1999 OPENCORES.ORG. All rights reserved.