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

Subversion Repositories i650

[/] [i650/] [trunk/] [rtl/] [error_stop.v] - Blame information for rev 23

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

Line No. Rev Author Line
1 23 eightycc
`timescale 1ns / 1ps
2
//////////////////////////////////////////////////////////////////////////////////
3
// IBM 650 Reconstruction in Verilog (i650)
4
// 
5
// This file is part of the IBM 650 Reconstruction in Verilog (i650) project
6
// http:////www.opencores.org/project,i650
7
//
8
// Description: Error stop and sense controls.
9
// 
10
// Additional Comments: See US 2959351, Fig. 79.
11
//
12
// Copyright (c) 2015 Robert Abeles
13
//
14
// This source file is free software; you can redistribute it
15
// and/or modify it under the terms of the GNU Lesser General
16
// Public License as published by the Free Software Foundation;
17
// either version 2.1 of the License, or (at your option) any
18
// later version.
19
//
20
// This source is distributed in the hope that it will be
21
// useful, but WITHOUT ANY WARRANTY; without even the implied
22
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
23
// PURPOSE.  See the GNU Lesser General Public License for more
24
// details.
25
//
26
// You should have received a copy of the GNU Lesser General
27
// Public License along with this source; if not, download it
28
// from http://www.opencores.org/lgpl.shtml
29
//////////////////////////////////////////////////////////////////////////////////
30
`include "defines.v"
31
 
32
module error_stop (
33
    input rst,
34
    input ap, dp,
35
    input dxu, d10, wl,
36
    input err_restart_sw, err_reset, err_sense_reset, clock_err_sig,
37
          err_stop_sig, restart_reset_busy,
38
 
39
    output err_sense_light,
40
    output reg err_stop_ed0u, err_sense_restart, restart_reset
41
    );
42
 
43
   reg err_stop, err_sense;
44
 
45
   //-----------------------------------------------------------------------------
46
   //  The err_sense flip-flop does nothing but control a light.
47
   //-----------------------------------------------------------------------------
48
   assign err_sense_light = err_sense;
49
   always @(posedge ap)
50
      if      (rst)                       err_sense <= 0;
51
      else if (err_sense_reset)           err_sense <= 0;
52
      else if (err_stop & err_restart_sw) err_sense <= 1;
53
 
54
   //-----------------------------------------------------------------------------
55
   // This FSM controls the error stop / error restart process.
56
   //-----------------------------------------------------------------------------
57
   reg [0:2] state;
58
   `define restart_idle 3'd0
59
   `define restart_1    3'd1
60
   `define restart_2    3'd2
61
   `define restart_3    3'd3
62
   `define restart_4    3'd4
63
   `define restart_5    3'd5
64
   `define restart_6    3'd6
65
   always @(posedge dp)
66
      if (rst) begin
67
         err_sense_restart <= 0;
68
         restart_reset     <= 0;
69
         err_stop          <= 0;
70
         err_stop_ed0u     <= 0;
71
         state             <= `restart_idle;
72
      end else
73
         case (state)
74
            `restart_idle:    // start state, transition on external err signal
75
                              // error restart switch selects next state
76
               if (err_reset)
77
                  err_stop <= 0;
78
               else if (~err_stop & (clock_err_sig | err_stop_sig)) begin
79
                  err_stop <= 1;
80
                  if (err_restart_sw)
81
                     state <= `restart_1;
82
                  else
83
                     state <= `restart_5;
84
               end
85
            `restart_1:       // >>>error_sense switch position<<<
86
                              // wait for dxu
87
                              // signal console to begin restart reset
88
                              // turn off run latch
89
               if (dxu) begin
90
                  restart_reset <= 1;
91
                  err_stop_ed0u <= 1;
92
                  state <= `restart_2;
93
               end
94
            `restart_2: begin // wait for restart reset to start
95
               err_stop_ed0u <= 0;
96
               if (restart_reset_busy) begin
97
                  restart_reset <= 0;
98
                  state <= `restart_3;
99
               end
100
            end
101
            `restart_3:       // wait for end of restart reset
102
                              // turn on run latch
103
               if (~restart_reset_busy & wl & d10) begin
104
                  err_sense_restart <= 1;
105
                  err_stop <= 0;
106
                  state <= `restart_4;
107
               end
108
            `restart_4: begin
109
               err_sense_restart <= 0;
110
               state <= `restart_idle;
111
            end
112
            `restart_5:       // >>>error_stop switch position<<<
113
                              // turn off run latch
114
               if (dxu) begin
115
                  err_stop_ed0u <= 1;
116
                  state <= `restart_6;
117
               end
118
            `restart_6: begin
119
               err_stop_ed0u <= 0;
120
               state <= `restart_idle;
121
            end
122
         endcase;
123
 
124
endmodule

powered by: WebSVN 2.1.0

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