OpenCores
URL https://opencores.org/ocsvn/hf-risc/hf-risc/trunk

Subversion Repositories hf-risc

[/] [hf-risc/] [trunk/] [tools/] [riscv-gnu-toolchain-master/] [binutils/] [bfd/] [cpu-riscv.c] - Blame information for rev 13

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 serginhofr
/* BFD backend for RISC-V
2
   Copyright 2011-2015 Free Software Foundation, Inc.
3
 
4
   Contributed by Andrew Waterman (waterman@cs.berkeley.edu) at UC Berkeley.
5
   Based on MIPS target.
6
 
7
   This file is part of BFD, the Binary File Descriptor library.
8
 
9
   This program is free software; you can redistribute it and/or modify
10
   it under the terms of the GNU General Public License as published by
11
   the Free Software Foundation; either version 3 of the License, or
12
   (at your option) any later version.
13
 
14
   This program is distributed in the hope that it will be useful,
15
   but WITHOUT ANY WARRANTY; without even the implied warranty of
16
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
   GNU General Public License for more details.
18
 
19
   You should have received a copy of the GNU General Public License
20
   along with this program; see the file COPYING3. If not,
21
   see <http://www.gnu.org/licenses/>.  */
22
 
23
#include "sysdep.h"
24
#include "bfd.h"
25
#include "libbfd.h"
26
 
27
/* This routine is provided two arch_infos and returns an arch_info
28
   that is compatible with both, or NULL if none exists.  */
29
 
30
static const bfd_arch_info_type *
31
riscv_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b)
32
{
33
  if (a->arch != b->arch)
34
    return NULL;
35
 
36
  /* Machine compatibility is checked in
37
     _bfd_riscv_elf_merge_private_bfd_data.  */
38
 
39
  return a;
40
}
41
 
42
#define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT)           \
43
  {                                                     \
44
    BITS_WORD, /*  bits in a word */                    \
45
    BITS_ADDR, /* bits in an address */                 \
46
    8,  /* 8 bits in a byte */                          \
47
    bfd_arch_riscv,                                     \
48
    NUMBER,                                             \
49
    "riscv",                                            \
50
    PRINT,                                              \
51
    3,                                                  \
52
    DEFAULT,                                            \
53
    riscv_compatible,                                   \
54
    bfd_default_scan,                                   \
55
    bfd_arch_default_fill,                              \
56
    NEXT,                                               \
57
  }
58
 
59
enum
60
{
61
  I_riscv64,
62
  I_riscv32
63
};
64
 
65
#define NN(index) (&arch_info_struct[(index) + 1])
66
 
67
static const bfd_arch_info_type arch_info_struct[] =
68
{
69
  N (64, 64, bfd_mach_riscv64, "riscv:rv64", FALSE, NN (I_riscv64)),
70
  N (32, 32, bfd_mach_riscv32, "riscv:rv32", FALSE, 0)
71
};
72
 
73
/* The default architecture is riscv:rv64.  */
74
 
75
const bfd_arch_info_type bfd_riscv_arch =
76
  N (64, 64, 0, "riscv", TRUE, &arch_info_struct[0]);

powered by: WebSVN 2.1.0

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