LOGIN   :::   RECOVER PASS   :::   GET ACCOUNT    
Browse
  • Projects
  • Code (CVS)
  • Forums
  • News
  • Articles
  • Polls
  •  
    OpenCores
  • FAQ
  • CVS HowTo
  • Mission
  • Media
  • Tools
  • Sponsors
  • Mirrors
  • Logos
  • Contact us
  •  
    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 Apr 27 18:33:42 CEST 2008
    Subject: [cvs-checkins] MODIFIED: aemb ...
    Top
    Date: 00/08/04 27:18:33

    Modified: aemb/sw/cc/aemb core.hh heap.hh hook.hh msr.hh stack.hh
    stdio.hh thread.hh
    Log:
    License change to GPL3.


    Revision Changes Path
    1.3 aemb/sw/cc/aemb/core.hh

    http://www.opencores.org/cvsweb.shtml/aemb/sw/cc/aemb/core.hh.diff?r1=1.2&r2=1.3

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

    Index: core.hh
    ===================================================================
    RCS file: /cvsroot/sybreon/aemb/sw/cc/aemb/core.hh,v
    retrieving revision 1.2
    retrieving revision 1.3
    diff -u -b -r1.2 -r1.3
    --- core.hh 26 Apr 2008 19:31:35 -0000 1.2
    +++ core.hh 27 Apr 2008 16:33:42 -0000 1.3
    @@ -1,4 +1,4 @@
    -/* $Id: core.hh,v 1.2 2008/04/26 19:31:35 sybreon Exp $
    +/* $Id: core.hh,v 1.3 2008/04/27 16:33:42 sybreon Exp $
    **
    ** AEMB2 HI-PERFORMANCE CPU
    ** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@a...>
    @@ -6,17 +6,17 @@
    ** This file is part of AEMB.
    **
    ** AEMB 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 3 of the
    -** License, or (at your option) any later version.
    +** 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.
    **
    ** AEMB 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.
    +** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
    +** License for more details.
    **
    -** You should have received a copy of the GNU Lesser General Public
    -** License along with AEMB. If not, see <http://www.gnu.org/licenses/>.
    +** You should have received a copy of the GNU General Public License
    +** along with AEMB. If not, see <http://www.gnu.org/licenses/>.
    */

    /**
    @@ -46,6 +46,9 @@

    /*
    $Log: core.hh,v $
    + Revision 1.3 2008/04/27 16:33:42 sybreon
    + License change to GPL3.
    +
    Revision 1.2 2008/04/26 19:31:35 sybreon
    Made headers C compatible.




    1.5 aemb/sw/cc/aemb/heap.hh

    http://www.opencores.org/cvsweb.shtml/aemb/sw/cc/aemb/heap.hh.diff?r1=1.4&r2=1.5

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

    Index: heap.hh
    ===================================================================
    RCS file: /cvsroot/sybreon/aemb/sw/cc/aemb/heap.hh,v
    retrieving revision 1.4
    retrieving revision 1.5
    diff -u -b -r1.4 -r1.5
    --- heap.hh 26 Apr 2008 19:31:35 -0000 1.4
    +++ heap.hh 27 Apr 2008 16:33:42 -0000 1.5
    @@ -1,4 +1,4 @@
    -/* $Id: heap.hh,v 1.4 2008/04/26 19:31:35 sybreon Exp $
    +/* $Id: heap.hh,v 1.5 2008/04/27 16:33:42 sybreon Exp $
    **
    ** AEMB2 HI-PERFORMANCE CPU
    ** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@a...>
    @@ -6,17 +6,17 @@
    ** This file is part of AEMB.
    **
    ** AEMB 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 3 of the
    -** License, or (at your option) any later version.
    +** 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.
    **
    ** AEMB 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.
    +** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +** License for more details. ** -** You should have received a copy of the GNU Lesser General Public -** License along with AEMB. If not, see <http://www.gnu.org/licenses/>. +** You should have received a copy of the GNU General Public License +** along with AEMB. If not, see <http://www.gnu.org/licenses/>. */ /** @@ -75,6 +75,9 @@ /* $Log: heap.hh,v $ + Revision 1.5 2008/04/27 16:33:42 sybreon + License change to GPL3. + Revision 1.4 2008/04/26 19:31:35 sybreon Made headers C compatible. 1.9 aemb/sw/cc/aemb/hook.hh http://www.opencores.org/cvsweb.shtml/aemb/sw/cc/aemb/hook.hh.diff?r1=1.8&r2=1.9 (In the diff below, changes in quantity of whitespace are not shown.) Index: hook.hh =================================================================== RCS file: /cvsroot/sybreon/aemb/sw/cc/aemb/hook.hh,v retrieving revision 1.8 retrieving revision 1.9 diff -u -b -r1.8 -r1.9 --- hook.hh 27 Apr 2008 16:04:42 -0000 1.8 +++ hook.hh 27 Apr 2008 16:33:42 -0000 1.9 @@ -1,4 +1,4 @@ -/* $Id: hook.hh,v 1.8 2008/04/27 16:04:42 sybreon Exp $ +/* $Id: hook.hh,v 1.9 2008/04/27 16:33:42 sybreon Exp $ ** ** AEMB2 HI-PERFORMANCE CPU ** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@a...> @@ -6,17 +6,17 @@ ** This file is part of AEMB. ** ** AEMB 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 3 of the -** License, or (at your option) any later version. +** 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. ** ** AEMB 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. +** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +** License for more details. ** -** You should have received a copy of the GNU Lesser General Public -** License along with AEMB. If not, see <http://www.gnu.org/licenses/>. +** You should have received a copy of the GNU General Public License +** along with AEMB. If not, see <http://www.gnu.org/licenses/>. */ /** @@ -62,7 +62,7 @@ void _program_clean() { - waitMutex(); // enter critical section + _mtx_lock(); // enter critical section // unify the stack backwards for thread 1 if (isThread0()) @@ -71,7 +71,7 @@ setStack(getStack() + (getStackSize() >> 1)); } - signalMutex(); // exit critical section + _mtx_free(); // exit critical section } /** @@ -84,7 +84,7 @@ void _program_init() { - waitMutex(); // enter critical section + _mtx_lock(); // enter critical section // split and shift the stack for thread 1 if (isThread0()) // main thread @@ -95,11 +95,11 @@ dupStack((unsigned int *)newstk, (unsigned int *)oldstk, (unsigned int *)getStackTop()); - signalMutex(); // exit critical section + _mtx_free(); // exit critical section while (1) asm volatile ("nop"); // lock thread } - signalMutex(); // exit critical section + _mtx_free(); // exit critical section } semaphore __malloc_mutex = 1; @@ -113,7 +113,7 @@ void __malloc_lock(struct _reent *reent) { - waitMutex(); + _mtx_lock(); } /** @@ -125,7 +125,7 @@ void __malloc_unlock(struct _reent *reent) { - signalMutex(); + _mtx_free(); } #ifdef __cplusplus @@ -143,6 +143,9 @@ /* $Log: hook.hh,v $ + Revision 1.9 2008/04/27 16:33:42 sybreon + License change to GPL3. + Revision 1.8 2008/04/27 16:04:42 sybreon Minor cosmetic changes. 1.8 aemb/sw/cc/aemb/msr.hh http://www.opencores.org/cvsweb.shtml/aemb/sw/cc/aemb/msr.hh.diff?r1=1.7&r2=1.8 (In the diff below, changes in quantity of whitespace are not shown.) Index: msr.hh =================================================================== RCS file: /cvsroot/sybreon/aemb/sw/cc/aemb/msr.hh,v retrieving revision 1.7 retrieving revision 1.8 diff -u -b -r1.7 -r1.8 --- msr.hh 26 Apr 2008 19:31:35 -0000 1.7 +++ msr.hh 27 Apr 2008 16:33:42 -0000 1.8 @@ -1,4 +1,4 @@ -/* $Id: msr.hh,v 1.7 2008/04/26 19:31:35 sybreon Exp $ +/* $Id: msr.hh,v 1.8 2008/04/27 16:33:42 sybreon Exp $ ** ** AEMB2 HI-PERFORMANCE CPU ** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@a...> @@ -6,17 +6,17 @@ ** This file is part of AEMB. ** ** AEMB 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 3 of the -** License, or (at your option) any later version. +** 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. ** ** AEMB 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. +** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +** License for more details. ** -** You should have received a copy of the GNU Lesser General Public -** License along with AEMB. If not, see <http://www.gnu.org/licenses/>. +** You should have received a copy of the GNU General Public License +** along with AEMB. If not, see <http://www.gnu.org/licenses/>. */ /** @@ -30,24 +30,26 @@ #ifndef AEMB_MSR_HH #define AEMB_MSR_HH -#ifdef __cplusplus -namespace aemb { -#endif - +// STANDARD BITS #define MSR_BE (1 << 0) ///< Buslock Enable #define MSR_IE (1 << 1) ///< Interrupt Enable #define MSR_C (1 << 2) ///< Arithmetic Carry #define MSR_BIP (1 << 3) ///< Break in Progress -#define MSR_MTX (1 << 4) ///< Hardware Mutex #define MSR_ICE (1 << 5) ///< Instruction Cache Enable #define MSR_DZ (1 << 6) ///< Division by Zero #define MSR_DCE (1 << 7) ///< Data Cache Enable +// CUSTOM BITS +#define MSR_MTX (1 << 4) ///< Hardware Mutex #define MSR_PHA (1 << 29) ///< Hardware Thread Phase #define MSR_HTX (1 << 30) ///< Hardware Threads Extension #define MSR_CC (1 << 31) ///< Carry Copy +#ifdef __cplusplus +namespace aemb { +#endif + /** Read the value of the MSR register @return register contents @@ -140,6 +142,9 @@ /* $Log: msr.hh,v $ + Revision 1.8 2008/04/27 16:33:42 sybreon + License change to GPL3. + Revision 1.7 2008/04/26 19:31:35 sybreon Made headers C compatible. 1.7 aemb/sw/cc/aemb/stack.hh http://www.opencores.org/cvsweb.shtml/aemb/sw/cc/aemb/stack.hh.diff?r1=1.6&r2=1.7 (In the diff below, changes in quantity of whitespace are not shown.) Index: stack.hh =================================================================== RCS file: /cvsroot/sybreon/aemb/sw/cc/aemb/stack.hh,v retrieving revision 1.6 retrieving revision 1.7 diff -u -b -r1.6 -r1.7 --- stack.hh 27 Apr 2008 16:04:42 -0000 1.6 +++ stack.hh 27 Apr 2008 16:33:42 -0000 1.7 @@ -1,4 +1,4 @@ -/* $Id: stack.hh,v 1.6 2008/04/27 16:04:42 sybreon Exp $ +/* $Id: stack.hh,v 1.7 2008/04/27 16:33:42 sybreon Exp $ ** ** AEMB2 HI-PERFORMANCE CPU ** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@a...> @@ -6,17 +6,17 @@ ** This file is part of AEMB. ** ** AEMB 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 3 of the -** License, or (at your option) any later version. +** 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. ** ** AEMB 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. +** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +** License for more details. ** -** You should have received a copy of the GNU Lesser General Public -** License along with AEMB. If not, see <http://www.gnu.org/licenses/>. +** You should have received a copy of the GNU General Public License +** along with AEMB. If not, see <http://www.gnu.org/licenses/>. */ /** @@ -121,6 +121,9 @@ /* $Log: stack.hh,v $ + Revision 1.7 2008/04/27 16:33:42 sybreon + License change to GPL3. + Revision 1.6 2008/04/27 16:04:42 sybreon Minor cosmetic changes. 1.4 aemb/sw/cc/aemb/stdio.hh http://www.opencores.org/cvsweb.shtml/aemb/sw/cc/aemb/stdio.hh.diff?r1=1.3&r2=1.4 (In the diff below, changes in quantity of whitespace are not shown.) Index: stdio.hh =================================================================== RCS file: /cvsroot/sybreon/aemb/sw/cc/aemb/stdio.hh,v retrieving revision 1.3 retrieving revision 1.4 diff -u -b -r1.3 -r1.4 --- stdio.hh 26 Apr 2008 19:31:35 -0000 1.3 +++ stdio.hh 27 Apr 2008 16:33:42 -0000 1.4 @@ -1,4 +1,4 @@ -/* $Id: stdio.hh,v 1.3 2008/04/26 19:31:35 sybreon Exp $ +/* $Id: stdio.hh,v 1.4 2008/04/27 16:33:42 sybreon Exp $ ** ** AEMB2 HI-PERFORMANCE CPU ** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@a...> @@ -6,17 +6,17 @@ ** This file is part of AEMB. ** ** AEMB 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 3 of the -** License, or (at your option) any later version. +** 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. ** ** AEMB 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. +** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +** License for more details. ** -** You should have received a copy of the GNU Lesser General Public -** License along with AEMB. If not, see <http://www.gnu.org/licenses/>. +** You should have received a copy of the GNU General Public License +** along with AEMB. If not, see <http://www.gnu.org/licenses/>. */ /** @@ -60,6 +60,9 @@ /* $Log: stdio.hh,v $ + Revision 1.4 2008/04/27 16:33:42 sybreon + License change to GPL3. + Revision 1.3 2008/04/26 19:31:35 sybreon Made headers C compatible. 1.9 aemb/sw/cc/aemb/thread.hh http://www.opencores.org/cvsweb.shtml/aemb/sw/cc/aemb/thread.hh.diff?r1=1.8&r2=1.9 (In the diff below, changes in quantity of whitespace are not shown.) Index: thread.hh =================================================================== RCS file: /cvsroot/sybreon/aemb/sw/cc/aemb/thread.hh,v retrieving revision 1.8 retrieving revision 1.9 diff -u -b -r1.8 -r1.9 --- thread.hh 26 Apr 2008 19:31:35 -0000 1.8 +++ thread.hh 27 Apr 2008 16:33:42 -0000 1.9 @@ -1,4 +1,4 @@ -/* $Id: thread.hh,v 1.8 2008/04/26 19:31:35 sybreon Exp $ +/* $Id: thread.hh,v 1.9 2008/04/27 16:33:42 sybreon Exp $ ** ** AEMB2 HI-PERFORMANCE CPU ** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@a...> @@ -6,17 +6,17 @@ ** This file is part of AEMB. ** ** AEMB 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 3 of the -** License, or (at your option) any later version. +** 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. ** ** AEMB 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. +** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public +** License for more details. ** -** You should have received a copy of the GNU Lesser General Public -** License along with AEMB. If not, see <http://www.gnu.org/licenses/>. +** You should have received a copy of the GNU General Public License +** along with AEMB. If not, see <http://www.gnu.org/licenses/>. */ /** @@ -72,10 +72,10 @@ Hardware Mutex Signal. Unlock the hardware mutex, which is unlocked on reset. */ - inline void signalMutex() + inline void _mtx_free() { int tmp; - asm volatile ("msrclr %0, 0x0010":"=r"(tmp)); + asm volatile ("msrclr %0, %1":"=r"(tmp):"K"(MSR_MTX)); } /** @@ -84,12 +84,12 @@ Waits until the hardware mutex is unlocked. This should be used as part of a larger software mutex mechanism. */ - inline void waitMutex() + inline void _mtx_lock() { int rmsr; do { - asm volatile ("msrset %0, 0x0010":"=r"(rmsr)); + asm volatile ("msrset %0, %1":"=r"(rmsr):"K"(MSR_MTX)); } while (rmsr & MSR_MTX); } @@ -103,19 +103,33 @@ required as the threads are hardware. */ - typedef volatile int semaphore; + typedef int semaphore; /** - Increment the semaphore + Software Semaphore Signal. + + Increment the semaphore and run. This is a software mechanism. */ - inline void signal(semaphore _sem) { _sem++; } + inline void signal(volatile semaphore _sem) + { + _mtx_lock(); + _sem++; + _mtx_free(); + } /** - Decrement the semaphore and block if < 0 + Software Semaphore Wait. + + Decrement the semaphore and block if < 0. This is a software + mechanism. */ - inline void wait(semaphore _sem) { _sem--; while (_sem < 0); } // block while - // semaphore is - // negative + inline void wait(volatile semaphore _sem) + { + _mtx_lock(); + _sem--; + _mtx_free(); + while (_sem < 0); + } semaphore __mutex_rendezvous0 = 0; ///< internal rendezvous mutex semaphore __mutex_rendezvous1 = 1; ///< internal rendezvous mutex @@ -124,7 +138,7 @@ Implements a simple rendezvous mechanism */ - void rendezvous() + inline void rendezvous() { if (isThread1()) { @@ -146,6 +160,9 @@ /* $Log: thread.hh,v $ + Revision 1.9 2008/04/27 16:33:42 sybreon + License change to GPL3. + Revision 1.8 2008/04/26 19:31:35 sybreon Made headers C compatible.

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