1 |
19 |
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: Register validity checking.
|
9 |
|
|
//
|
10 |
|
|
// Additional Comments: See US 2959351, Fig. 82.
|
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 biq_check (
|
33 |
|
|
input [0:6] biq,
|
34 |
|
|
output invalid
|
35 |
|
|
);
|
36 |
|
|
|
37 |
|
|
//-----------------------------------------------------------------------------
|
38 |
20 |
eightycc |
// Validate bi-quinary digit.
|
39 |
19 |
eightycc |
//-----------------------------------------------------------------------------
|
40 |
|
|
wire q0_or_q1 = biq[`biq_q0] | biq[`biq_q1];
|
41 |
|
|
wire q2_or_q3_or_q4 = biq[`biq_q2] | biq[`biq_q3] | biq[`biq_q4];
|
42 |
|
|
wire b0_or_b5 = biq[`biq_b0] | biq[`biq_b5];
|
43 |
|
|
wire q0_and_q1 = biq[`biq_q0] & biq[`biq_q1];
|
44 |
|
|
wire b0_and_b5 = biq[`biq_b0] & biq[`biq_b5];
|
45 |
|
|
wire q2_and_q4 = biq[`biq_q2] & biq[`biq_q4];
|
46 |
|
|
wire q3_and_q4 = biq[`biq_q3] & biq[`biq_q4];
|
47 |
|
|
wire q2_and_q3 = biq[`biq_q2] & biq[`biq_q3];
|
48 |
|
|
assign invalid = (q2_and_q4)
|
49 |
20 |
eightycc |
| (q3_and_q4)
|
50 |
|
|
| (q2_and_q3)
|
51 |
|
|
| (q0_or_q1 & q2_or_q3_or_q4)
|
52 |
|
|
| (q0_and_q1)
|
53 |
|
|
| (b0_and_b5)
|
54 |
|
|
| ~(b0_or_b5 & (q0_or_q1 | q2_or_q3_or_q4));
|
55 |
19 |
eightycc |
|
56 |
|
|
endmodule
|
57 |
|
|
|
58 |
|
|
module checking (
|
59 |
|
|
input rst,
|
60 |
|
|
input bp,
|
61 |
|
|
input d1_dx,
|
62 |
|
|
input [0:6] acc_ontime, prog_ontime, dist_ontime,
|
63 |
|
|
input error_reset, tlu_or_zero_check,
|
64 |
|
|
|
65 |
|
|
output error_stop, acc_check_light, prog_check_light, dist_check_light
|
66 |
|
|
);
|
67 |
|
|
|
68 |
|
|
reg acc_error, prog_error, dist_error;
|
69 |
|
|
wire acc_invalid, prog_invalid, dist_invalid;
|
70 |
|
|
biq_check bc1 (acc_ontime, acc_invalid);
|
71 |
|
|
biq_check bc2 (prog_ontime, prog_invalid);
|
72 |
|
|
biq_check bc3 (dist_ontime, dist_invalid);
|
73 |
|
|
assign error_stop = tlu_or_zero_check | acc_error | prog_error | dist_error;
|
74 |
20 |
eightycc |
assign acc_check_light = acc_error;
|
75 |
|
|
assign prog_check_light = prog_error;
|
76 |
|
|
assign dist_check_light = dist_error;
|
77 |
19 |
eightycc |
|
78 |
|
|
always @(posedge bp)
|
79 |
|
|
if (rst) begin
|
80 |
|
|
acc_error <= 0;
|
81 |
|
|
prog_error <= 0;
|
82 |
|
|
dist_error <= 0;
|
83 |
|
|
end else if (error_reset) begin
|
84 |
|
|
acc_error <= 0;
|
85 |
|
|
prog_error <= 0;
|
86 |
|
|
dist_error <= 0;
|
87 |
|
|
end else begin
|
88 |
|
|
if (acc_invalid) acc_error <= 1;
|
89 |
|
|
if (prog_invalid & d1_dx) prog_error <= 1;
|
90 |
|
|
if (dist_invalid) dist_error <= 1;
|
91 |
|
|
end;
|
92 |
|
|
|
93 |
|
|
endmodule
|