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
  • Find Resources
  • Job Opportunity
  •  
    Tools
  • Search
      
  • Download Cores (CVSGet)
  •  
    More
  • Wishbone
  • Perlilog
  • EDA tools
  • OpenTech CD
  •  
    Navigation: All forums > Openrisc > Message List > Message Post

    Message

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

    From: György 'nog' Jeney<nog@s...>
    Date: Mon Jan 24 20:58:26 CET 2005
    Subject: [openrisc] Re: [or1ksim] Mark destination operand in or32.c
    Top
    On 0, György 'nog' Jeney <nog@s...> wrote:
    > Hi,
    >
    > I have changed the architechture definition in or32.c such that the rD register
    > is always a destination register. This has the great advantage that this
    > information is computed when the operand tables are generated and not when the
    > instructions themselves are executed. I have also added some documentation of
    > the OPTYPE_ flags.
    >
    > ChangeLog:
    > Mark wich operand is the destination operand in the architechture definition.
    >
    This time with the patch.

    nog.
    -------------- next part --------------
    Index: cpu/or1k/opcode/or32.h
    ===================================================================
    RCS file: /home/oc/cvs/or1k/or1ksim/cpu/or1k/opcode/or32.h,v
    retrieving revision 1.18
    diff -u -p -r1.18 or32.h
    --- cpu/or1k/opcode/or32.h 11 Jan 2005 15:41:54 -0000 1.18
    +++ cpu/or1k/opcode/or32.h 24 Jan 2005 15:18:08 -0000
    @@ -61,7 +61,7 @@ struct or32_opcode {
    ,() Itself. Characters appears in the assembly code.
    rA Register operand.
    rB Register operand.
    - rD Register operand.
    + rD Register operand (destination).
    I An immediate operand, range -32768 to 32767.
    J An immediate operand, range . (unused)
    K An immediate operand, range 0 to 65535.
    @@ -74,7 +74,7 @@ struct or32_opcode {
    /* Opcode and operand encoding. */
    char *encoding;

    -#if defined HAS_EXECUTION && !SIMPLE_EXECUTION
    +#if defined(HAS_EXECUTION) && !SIMPLE_EXECUTION
    char *function_name;
    #else /* defined HAS_EXECUTION && !SIMPLE_EXECUTION */
    void (*exec)();
    @@ -83,13 +83,21 @@ struct or32_opcode {
    unsigned int flags;
    };

    +/* This operand is the last in the list */
    #define OPTYPE_LAST (0x80000000)
    +/* This operand marks the end of the operand sequence (for things like I(rD)) */
    #define OPTYPE_OP (0x40000000)
    +/* The operand specifies a register index */
    #define OPTYPE_REG (0x20000000)
    +/* The operand must be sign extended */
    #define OPTYPE_SIG (0x10000000)
    +/* Operand is a relative address, the `I' in `I(rD)' */
    #define OPTYPE_DIS (0x08000000)
    +/* The operand is a destination */
    #define OPTYPE_DST (0x04000000)
    +/* Which bit of the operand is the sign bit */
    #define OPTYPE_SBIT (0x00001F00)
    +/* Amount to shift the instruction word right to get the operand */
    #define OPTYPE_SHR (0x0000001F)
    #define OPTYPE_SBIT_SHR (8)

    Index: cpu/or32/or32.c
    ===================================================================
    RCS file: /home/oc/cvs/or1k/or1ksim/cpu/or32/or32.c,v
    retrieving revision 1.37
    diff -u -p -r1.37 or32.c
    --- cpu/or32/or32.c 11 Jan 2005 15:41:58 -0000 1.37
    +++ cpu/or32/or32.c 24 Jan 2005 15:18:34 -0000
    @@ -85,26 +85,24 @@ CONST struct or32_letter or32_letters[]
    code (when assembling).
    */

    -#if defined HAS_EXECUTION && SIMPLE_EXECUTION
    -#define EFN &l_none
    -#define EF(func) &(func)
    -#define EFI &l_invalid
    -#else /* HAS_EXECUTION */
    -
    -#ifndef HAS_EXECUTION
    -#define EFN &l_none
    -#define EF(func) EFN
    -#define EFI EFN
    -#else /* !HAS_EXECUTION */
    -#define EFN "l_none"
    -#define EFI "l_invalid"
    -#ifdef __GNUC__
    -#define EF(func) #func
    -#else
    -#define EF(func) "func"
    -#endif
    -#endif /* !HAS_EXECUTION */
    -
    +#ifdef HAS_EXECUTION
    +# if SIMPLE_EXECUTION
    +# define EFN &l_none
    +# define EF(func) &(func)
    +# define EFI &l_invalid
    +# else /* SIMPLE_EXECUTION */
    +# define EFN "l_none" +# define EFI "l_invalid" +# ifdef __GNUC__ +# define EF(func) #func +# else +# define EF(func) "func" +# endif +# endif /* SIMPLE_EXECUTION */ +#else /* HAS_EXECUTION */ +# define EFN &l_none +# define EF(func) EFN +# define EFI EFN #endif /* HAS_EXECUTION */ CONST struct or32_opcode or32_opcodes[] = @@ -292,10 +290,10 @@ CONST struct or32_opcode or32_opcodes[] { "lf.sfle.d", "rA,rB", "11 0x2 ----- AAAAA BBBB B--- 0x1 0xD", EFI, 0 }, { "lf.cust1.d", "rA,rB", "11 0x2 ----- AAAAA BBBB B--- 0xE ----", EFI, 0 }, -{ "l.sd", "I(rA),rB", "11 0x4 IIIII AAAAA BBBB BIII IIII IIII", EFI, 0 }, -{ "l.sw", "I(rA),rB", "11 0x5 IIIII AAAAA BBBB BIII IIII IIII", EF(l_sw), 0 }, -{ "l.sb", "I(rA),rB", "11 0x6 IIIII AAAAA BBBB BIII IIII IIII", EF(l_sb), 0 }, -{ "l.sh", "I(rA),rB", "11 0x7 IIIII AAAAA BBBB BIII IIII IIII", EF(l_sh), 0 }, +{ "l.sd", "I(rD),rB", "11 0x4 IIIII DDDDD BBBB BIII IIII IIII", EFI, 0 }, +{ "l.sw", "I(rD),rB", "11 0x5 IIIII DDDDD BBBB BIII IIII IIII", EF(l_sw), 0 }, +{ "l.sb", "I(rD),rB", "11 0x6 IIIII DDDDD BBBB BIII IIII IIII", EF(l_sb), 0 }, +{ "l.sh", "I(rD),rB", "11 0x7 IIIII DDDDD BBBB BIII IIII IIII", EF(l_sh), 0 }, { "l.add", "rD,rA,rB", "11 0x8 DDDDD AAAAA BBBB B-00 ---- 0x0", EF(l_add), OR32_W_FLAG }, { "l.addc", "rD,rA,rB", "11 0x8 DDDDD AAAAA BBBB B-00 ---- 0x1", EF(l_addc), OR32_W_FLAG }, @@ -369,12 +367,8 @@ CONST struct or32_opcode or32_opcodes[] /* **INDENT-ON** */ /* Define dummy, if debug is not defined. */ -#if !defined HAS_DEBUG -void debug(int level, const char *format, ...) -{ - /* Just to get rid of warnings. */ - format = level = 0; -} +#ifndef HAS_DEBUG +#define debug(l, fmt...) ; #endif CONST int num_opcodes = ((sizeof(or32_opcodes)) / (sizeof(struct or32_opcode))) - 1; @@ -463,7 +457,7 @@ l_none() /*** Finite automata for instruction decoding building code ***/ -/* Find simbols in encoding. */ +/* Find symbols in encoding. */ unsigned long insn_extract(param_ch, enc_initial) char param_ch; @@ -511,7 +505,7 @@ unsigned long *automata; int nuncovered; int curpass = 0; -/* MM: Struct that hold runtime build information about instructions. */ +/* MM: Struct that holds runtime build information about instructions. */ struct temp_insn_struct { unsigned long insn; @@ -658,6 +652,8 @@ parse_params (CONST struct or32_opcode * { args++; type |= OPTYPE_REG; + if(args[1] == 'D') + type |= OPTYPE_DST; } else if (isalpha (*args)) {

    ReferenceAuthor
    [openrisc] [or1ksim] Mark destination operand in or32.cGyörgy 'nog' Jeney

    Follow upAuthor
    [openrisc] Re: [or1ksim] Mark destination operand in or32.cMatjaz Breskvar

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