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 check accumulator, adder carry, and TLU.
|
9 |
|
|
//
|
10 |
|
|
// Additional Comments: See US 2959351, Fig. 83.
|
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 check_acc_tlu (
|
33 |
|
|
input rst,
|
34 |
|
|
input ap, bp,
|
35 |
|
|
input d0, d2, d1_dx,
|
36 |
|
|
input [0:6] acc_ped_out,
|
37 |
|
|
input sel_store_add_gate, err_reset, carry_test_latch, no_carry_test_latch,
|
38 |
|
|
|
39 |
|
|
output acc_zero, acc_no_zero,
|
40 |
|
|
output reg check_latch
|
41 |
|
|
);
|
42 |
|
|
|
43 |
|
|
reg tlu_check;
|
44 |
|
|
assign acc_zero = acc_ped_out[`biq_b0] & acc_ped_out[`biq_q0];
|
45 |
|
|
assign acc_no_zero = acc_ped_out[`biq_b5] | acc_ped_out[`biq_q4]
|
46 |
|
|
| acc_ped_out[`biq_q3] | acc_ped_out[`biq_q2]
|
47 |
|
|
| acc_ped_out[`biq_q1];
|
48 |
|
|
wire acc_err1_p = ~(acc_zero | acc_no_zero) & d1_dx;
|
49 |
|
|
wire acc_err2_p = (acc_zero & acc_no_zero) & d1_dx;
|
50 |
|
|
wire carry_err1_p = ~(carry_test_latch | no_carry_test_latch) & tlu_check;
|
51 |
|
|
wire carry_err2_p = carry_test_latch & no_carry_test_latch;
|
52 |
|
|
wire set_check_latch_p = acc_err1_p | acc_err2_p | carry_err1_p | carry_err2_p;
|
53 |
|
|
|
54 |
|
|
always @(posedge ap)
|
55 |
|
|
if (rst) begin
|
56 |
|
|
tlu_check <= 0;
|
57 |
|
|
end else if (d0) begin
|
58 |
|
|
tlu_check <= 0;
|
59 |
|
|
end else if (d2 & sel_store_add_gate) begin
|
60 |
|
|
tlu_check <= 1;
|
61 |
|
|
end;
|
62 |
|
|
|
63 |
|
|
always @(posedge bp)
|
64 |
|
|
if (rst) begin
|
65 |
|
|
check_latch <= 0;
|
66 |
|
|
end else if (err_reset) begin
|
67 |
|
|
check_latch <= 0;
|
68 |
|
|
end else if (set_check_latch_p) begin
|
69 |
|
|
check_latch <= 1;
|
70 |
|
|
end;
|
71 |
|
|
|
72 |
|
|
endmodule
|