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

Subversion Repositories sc2v

[/] [sc2v/] [trunk/] [examples/] [stmach_k.cpp] - Blame information for rev 8

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 8 jcastillo
// stmach_k.cpp 
2
#include "stmach.h" 
3
void stmach_k::getnextst()
4
{
5
  play.write(false);
6
  recrd.write(false);
7
  erase.write(false);
8
  save.write(false);
9
  address.write(false);
10
  switch (current_state.read()) {
11
    case main_st:
12
      if (key.read() == 1) {
13
        next_state.write(review_st);
14
      } else {
15
        if (key.read() == 2) {
16
          next_state.write(send_st);
17
        } else {
18
          next_state.write(main_st);
19
        }
20
      }
21
      break;
22
 
23
    case record_st:
24
      if (key.read() == 5) {
25
        next_state.write(begin_rec_st);
26
      } else {
27
        next_state.write(record_st);
28
      }
29
      break;
30
 
31
    case begin_rec_st:
32
      //comment over here
33
      recrd.write(true);
34
      next_state.write(message_st);
35
      break;
36
 
37
    case message_st: //comment over here
38
      recrd.write(true);
39
      if (key.read() == 6) {
40
        next_state.write(send_st);
41
      } else {
42
        next_state.write(message_st);
43
      }
44
      break;
45
 
46
    default:
47
      next_state.write(main_st);
48
      break;
49
  } // end switch 
50
} // end method 
51
 
52
void stmach::setstate()
53
{
54
  current_state.write(next_state);
55
}

powered by: WebSVN 2.1.0

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