OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [pr42250.c] - Blame information for rev 298

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-O2 -fipa-type-escape" } */
3
 
4
extern double log10 (double __x);
5
extern double ceil (double __x);
6
extern double floor (double __x);
7
extern void free (void *__ptr);
8
extern void *my_malloc (unsigned int);
9
extern int num_rr_nodes;
10
static float get_cblock_trans (int *num_inputs_to_cblock,
11
                               int max_inputs_to_cblock,
12
                               float trans_cblock_to_lblock_buf,
13
                               float trans_sram_bit);
14
static float trans_per_mux (int num_inputs, float trans_sram_bit);
15
void
16
count_routing_transistors (int num_switch, float R_minW_nmos,
17
                           float R_minW_pmos)
18
{
19
  int *num_inputs_to_cblock;
20
  int iswitch, i, j, iseg, max_inputs_to_cblock;
21
  float input_cblock_trans;
22
  const float trans_sram_bit = 6.;
23
  float trans_cblock_to_lblock_buf;
24
  input_cblock_trans =
25
    get_cblock_trans (num_inputs_to_cblock, max_inputs_to_cblock,
26
                      trans_cblock_to_lblock_buf, trans_sram_bit);
27
}
28
 
29
static float
30
get_cblock_trans (int *num_inputs_to_cblock, int max_inputs_to_cblock,
31
                  float trans_cblock_to_lblock_buf, float trans_sram_bit)
32
{
33
  float *trans_per_cblock;
34
  float trans_count;
35
  int i, num_inputs;
36
 
37
  trans_per_cblock =
38
    (float *) my_malloc ((max_inputs_to_cblock + 1) * sizeof (float));
39
  for (i = 1; i <= max_inputs_to_cblock; i++)
40
    trans_per_cblock[i] =
41
      trans_per_mux (i, trans_sram_bit) + trans_cblock_to_lblock_buf;
42
  for (i = 0; i < num_rr_nodes; i++)
43
    {
44
      num_inputs = num_inputs_to_cblock[i];
45
      trans_count += trans_per_cblock[num_inputs];
46
    }
47
  free (trans_per_cblock);
48
  return (trans_count);
49
}
50
 
51
static float
52
trans_per_mux (int num_inputs, float trans_sram_bit)
53
{
54
  int nlevels, ilevel, current_inps;
55
  float ntrans = 0;
56
 
57
  if (num_inputs <= 1)
58
    return (0);
59
  nlevels = ceil (log10 (num_inputs) / log10 (2.) - 0.00001);
60
  current_inps = num_inputs;
61
  for (ilevel = 1; ilevel <= nlevels; ilevel++)
62
    {
63
      ntrans += 2 * floor (current_inps / 2.);
64
      current_inps = ceil (current_inps / 2.);
65
    }
66
  ntrans += trans_sram_bit * nlevels;
67
  return (ntrans);
68
}

powered by: WebSVN 2.1.0

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