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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fp/] [implementation/] [mmix/] [traffic.mms] - Blame information for rev 310

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

Line No. Rev Author Line
1 15 hellwig
* Traffic Signal Problem
2
rate GREG 100 % ridiculously small, for testing (shd be 250MHz)
3
t IS $255
4
Sensor_Buf IS Data_Segment
5
     GREG Sensor_Buf
6
 
7
       LOC #100
8
Lights  IS 3
9
Sensor IS 4
10
%Lights_Name BYTE "/dev/lights",0
11
%Sensor_Name BYTE "/dev/sensor",0
12
Lights_Name BYTE "lights",0     (temporary name)
13
Sensor_Name BYTE "sensor",0    (temporary name)
14
Lights_Args OCTA Lights_Name,BinaryWrite
15
Sensor_Args OCTA Sensor_Name,BinaryRead
16
Read_Sensor OCTA Sensor_Buf,1
17
Boulevard BYTE #77,0 DelMar green, WALK; Berkly red, DONT
18
          BYTE #7f,0 DelMar green, DONT; Berkly red, DONT
19
          BYTE #73,0 DelMar green, off;  Berkly red, DONT
20
          BYTE #bf,0 DelMar amber, DONT; Berkly red, DONT
21
Avenue    BYTE #dd,0 DelMar red, DONT; Berkly green, WALK
22
          BYTE #df,0 DelMar red, DONT; Berkly green, DONT
23
          BYTE #dc,0 DelMar red, DONT; Berkly green, off
24
          BYTE #ef,0 DelMar red, DONT; Berkly amber, DONT
25
 
26
goal GREG  % transition time for lights
27
Main GETA t,Lights_Args
28
     TRAP 0,Fopen,Lights
29
     GETA t,Sensor_Args
30
     TRAP 0,Fopen,Sensor
31
     GET  goal,rC
32
     ANDNMH goal,#ffff   % temporary patch
33
     JMP  2F
34
 
35
      GREG @
36
delay_go GREG
37
Delay GET t,rC
38
     ANDNMH t,#ffff   % temporary patch
39
      SUBU t,t,goal  NB: not CMPU
40
      PBN  t,Delay
41
      GO  delay_go,delay_go,0
42
 
43
flash_go GREG
44
n     GREG
45
green GREG
46
temp  GREG
47
Flash SET  n,8
48
1H    ADD  t,green,2*1
49
      TRAP 0,Fputs,Lights DONT WALK
50
      ADD  temp,goal,rate
51
      SR   t,rate,1
52
      ADDU goal,goal,t
53
      GO   delay_go,Delay
54
      ADD  t,green,2*2
55
      TRAP 0,Fputs,Lights off
56
      SET  goal,temp
57
      GO   delay_go,Delay
58
      SUB   n,n,1
59
      PBP   n,1B
60
      ADD  t,green,2*1
61
      TRAP 0,Fputs,Lights DONT WALK
62
      MUL  t,rate,4
63
      ADDU goal,goal,t
64
      GO   delay_go,Delay
65
      ADD  t,green,2*3
66
      TRAP 0,Fputs,Lights DONT WALK, amber
67
      GO   flash_go,flash_go,0
68
 
69
Wait  GET  goal,rC
70
     ANDNMH goal,#ffff   % temporary patch
71
1H    GETA t,Read_Sensor
72
      TRAP 0,Fread,Sensor
73
      LDB  t,Sensor_Buf
74
      BZ   t,Wait
75
      GETA green,Boulevard
76
      GO   flash_go,Flash
77
      MUL   t,rate,8
78
      ADDU  goal,goal,t
79
      GO   delay_go,Delay
80
      GETA  t,Avenue
81
      TRAP  0,Fputs,Lights
82
      MUL    t,rate,8
83
      ADDU  goal,goal,t
84
      GO   delay_go,Delay
85
      GETA  green,Avenue
86
      GO   flash_go,Flash
87
      GETA  t,Read_Sensor
88
      TRAP  0,Fread,Sensor % clear redundant signal
89
      MUL   t,rate,5
90
      ADDU  goal,goal,t
91
      GO   delay_go,Delay
92
2H    GETA  t,Boulevard
93
      TRAP  0,Fputs,Lights
94
      MUL   t,rate,18
95
      ADDU  goal,goal,t
96
      GO   delay_go,Delay
97
      JMP   1B

powered by: WebSVN 2.1.0

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