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

Subversion Repositories sc2v

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

Go to most recent revision | 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 23 jcastillo
  sc_uint <2> c[4];
19
  sc_uint <4> f;
20 21 jcastillo
  next_state.write (state.read ());
21
  array[0].write(1);
22
 
23
  c[1]=0;
24
 
25
  switch ((int) state.read ())
26
    {
27 23 jcastillo
     case 0x1:
28 21 jcastillo
      if (input1.read ())
29
        {
30
          next_state.write (1);
31
          a.write (true);
32
        }
33
      else if (input2.read () < input1.read())
34
        {
35
          next_state.write (2);
36
          a.write (false);
37
        }
38
      else
39
        {
40
          next_state.write (1);
41
          a.write (1);
42
        }
43
      break;
44
     case 0x2:
45 23 jcastillo
       //hola
46
       switch(input1.read()){
47
        case 0x1:
48
        case 0x2:
49
          switch(input1.read()){
50
           case 0x1:
51
            b.write(0);
52
            break;
53
           case 0x3:
54
            b.write(1);
55
            break;
56
          }
57
          b.write(0);
58
          break;
59
        case 0x3:
60
          b.write(1);
61
          break;
62
        }
63
 
64
 
65 21 jcastillo
      if (input2.read ())
66
        {
67
          next_state.write (2);
68
          b.write (1);
69
        }
70
      break;
71
     case 3:
72
      next_state.write (0);
73
      break;
74
    }
75
}

powered by: WebSVN 2.1.0

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