OpenCores
URL https://opencores.org/ocsvn/sc2v/sc2v/trunk

Subversion Repositories sc2v

[/] [sc2v/] [trunk/] [examples/] [dummy2.cpp] - Blame information for rev 36

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 21 jcastillo
#include "systemc.h"
2
 
3
void
4
fsm::regs ()
5
{
6
  if (rst.read ())
7
    {
8
      state.write (0);
9
    }
10
  else
11
    state.write (next_state);
12
}
13
 
14
void
15
fsm::fsm_proc ()
16
{
17
 
18 33 jcastillo
  struct {
19
     sc_uint<16> addr;
20
     sc_uint<32> data;
21
  } st;
22
 
23
  struct {
24
     sc_int<26> data1;
25
  } st1;
26
 
27 23 jcastillo
  sc_uint <2> c[4];
28
  sc_uint <4> f;
29 21 jcastillo
  next_state.write (state.read ());
30
  array[0].write(1);
31
 
32
  c[1]=0;
33
 
34
  switch ((int) state.read ())
35
    {
36 24 jcastillo
     case 0x1a:
37 21 jcastillo
      if (input1.read ())
38
        {
39 24 jcastillo
          next_state.write (sc_uint<4>(0x1b1));
40 21 jcastillo
          a.write (true);
41 33 jcastillo
          st1.data1=8;
42 21 jcastillo
        }
43
      else if (input2.read () < input1.read())
44
        {
45
          next_state.write (2);
46
          a.write (false);
47
        }
48
      else
49
        {
50
          next_state.write (1);
51
          a.write (1);
52
        }
53
      break;
54 24 jcastillo
     case 0xfaf67:
55 23 jcastillo
       //hola
56
       switch(input1.read()){
57
        case 0x1:
58
        case 0x2:
59
          switch(input1.read()){
60
           case 0x1:
61
            b.write(0);
62
            break;
63
           case 0x3:
64
            b.write(1);
65
            break;
66
          }
67
          b.write(0);
68
          break;
69
        case 0x3:
70
          b.write(1);
71
          break;
72
        }
73
 
74
 
75 21 jcastillo
      if (input2.read ())
76
        {
77
          next_state.write (2);
78
          b.write (1);
79
        }
80
      break;
81 24 jcastillo
     case 35:
82 21 jcastillo
      next_state.write (0);
83
      break;
84
    }
85
}
86 25 jcastillo
 
87
void fsm::dummy_proc(){
88 33 jcastillo
  struct {
89
     sc_int<26> data1;
90
     sc_uint<32> data2;
91
  } st2;
92
 
93
  st2.data1=6;
94
  st2.data2=8;
95
  w.write(sc_uint<1>(2));
96 25 jcastillo
 
97
}

powered by: WebSVN 2.1.0

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