Line 31... |
Line 31... |
`include "defines.v"
|
`include "defines.v"
|
|
|
module operator_ctl (
|
module operator_ctl (
|
input rst, clk,
|
input rst, clk,
|
input ap, dp,
|
input ap, dp,
|
input dx, d0, d1, d2, d3, d4, d5, d6, d10,
|
input dx, d0, d1, d2, d3, d4, d5, d6, d9, d10,
|
input wu, hp,
|
input wu, wl, hp,
|
input [0:3] early_idx, ontime_idx,
|
input [0:3] early_idx, ontime_idx,
|
|
|
input [0:6] cmd_digit_in, io_buffer_in, gs_in, acc_ontime, dist_ontime,
|
input [0:6] cmd_digit_in, io_buffer_in, gs_in, acc_ontime, dist_ontime,
|
prog_ontime,
|
prog_ontime,
|
input [0:5] command,
|
input [0:5] command,
|
Line 47... |
Line 47... |
output reg[0:14] gs_ram_addr,
|
output reg[0:14] gs_ram_addr,
|
output reg read_gs, write_gs,
|
output reg read_gs, write_gs,
|
output reg pgm_start, pgm_stop, err_reset, err_sense_reset,
|
output reg pgm_start, pgm_stop, err_reset, err_sense_reset,
|
output run_control, half_or_pgm_stop, ri_storage, ro_storage,
|
output run_control, half_or_pgm_stop, ri_storage, ro_storage,
|
storage_control,
|
storage_control,
|
output reg man_pgm_reset, man_acc_reset, set_8000, reset_8000,
|
output reg man_pgm_reset, man_acc_reset, hard_reset,
|
hard_reset,
|
output set_8000, reset_8000,
|
|
|
output reg[0:6] cmd_digit_out,
|
output reg[0:6] cmd_digit_out,
|
output reg busy, digit_ready,
|
output reg busy, digit_ready,
|
output reg punch_card, read_card, card_digit_ready
|
output reg punch_card, read_card, card_digit_ready
|
);
|
);
|
Line 75... |
Line 75... |
assign storage_control = run_control | disp_sw_ro;
|
assign storage_control = run_control | disp_sw_ro;
|
assign display_digit = (disp_sw_lacc | disp_sw_uacc)? acc_ontime
|
assign display_digit = (disp_sw_lacc | disp_sw_uacc)? acc_ontime
|
: (disp_sw_dist | disp_sw_ri | disp_sw_ro)? dist_ontime
|
: (disp_sw_dist | disp_sw_ri | disp_sw_ro)? dist_ontime
|
: disp_sw_pgm? prog_ontime
|
: disp_sw_pgm? prog_ontime
|
: `biq_blank;
|
: `biq_blank;
|
|
assign set_8000 = man_pgm_reset & (ctl_sw_addr_stop | ctl_sw_run);
|
|
assign reset_8000 = man_pgm_reset & ctl_sw_manual;
|
|
|
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
// Calculate the RAM address of the general storage word at address gs_addr_.
|
// Calculate the RAM address of the general storage word at address gs_addr_.
|
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
reg [0:6] gs_addr_th, gs_addr_h, gs_addr_t, gs_addr_u;
|
reg [0:6] gs_addr_th, gs_addr_h, gs_addr_t, gs_addr_u;
|
Line 127... |
Line 129... |
`define state_read_gs_4 6'd33
|
`define state_read_gs_4 6'd33
|
`define state_read_gs_5 6'd34
|
`define state_read_gs_5 6'd34
|
`define state_read_gs_6 6'd35
|
`define state_read_gs_6 6'd35
|
`define state_write_gs_1 6'd36
|
`define state_write_gs_1 6'd36
|
`define state_write_gs_2 6'd37
|
`define state_write_gs_2 6'd37
|
|
`define state_write_gs_2a 6'd63
|
`define state_write_gs_3 6'd38
|
`define state_write_gs_3 6'd38
|
`define state_write_gs_4 6'd39
|
`define state_write_gs_4 6'd39
|
`define state_write_gs_5 6'd40
|
`define state_write_gs_5 6'd40
|
`define state_clear_drum_1 6'd41
|
`define state_read_acc_1 6'd41
|
`define state_clear_drum_2 6'd42
|
`define state_read_acc_2 6'd42
|
`define state_clear_drum_3 6'd43
|
`define state_read_acc_3 6'd43
|
`define state_load_gs_1 6'd44
|
`define state_read_dist_1 6'd44
|
`define state_load_gs_2 6'd45
|
`define state_read_dist_2 6'd45
|
`define state_dump_gs_1 6'd46
|
`define state_read_dist_3 6'd46
|
`define state_dump_gs_2 6'd47
|
`define state_read_prog_1 6'd47
|
`define state_dump_gs_3 6'd48
|
`define state_read_prog_2 6'd48
|
`define state_dump_gs_4 6'd49
|
`define state_read_prog_3 6'd49
|
|
`define state_clear_drum_1 6'd50
|
|
`define state_clear_drum_2 6'd51
|
|
`define state_clear_drum_3 6'd52
|
|
`define state_load_gs_1 6'd53
|
|
`define state_load_gs_2 6'd54
|
|
`define state_dump_gs_1 6'd55
|
|
`define state_dump_gs_2 6'd56
|
|
`define state_dump_gs_3 6'd57
|
|
`define state_dump_gs_4 6'd58
|
|
|
always @(posedge clk) begin
|
always @(posedge clk) begin
|
if (rst) begin
|
if (rst) begin
|
console_to_addr <= 0;
|
console_to_addr <= 0;
|
pgm_start <= 0;
|
pgm_start <= 0;
|
pgm_stop <= 0;
|
pgm_stop <= 0;
|
err_reset <= 0;
|
err_reset <= 0;
|
err_sense_reset <= 0;
|
err_sense_reset <= 0;
|
man_pgm_reset <= 0;
|
man_pgm_reset <= 0;
|
man_acc_reset <= 0;
|
man_acc_reset <= 0;
|
set_8000 <= 0;
|
|
reset_8000 <= 0;
|
|
hard_reset <= 0;
|
hard_reset <= 0;
|
|
|
// reset console switches
|
// reset console switches
|
pgm_sw_stop <= 0;
|
pgm_sw_stop <= 0;
|
pgm_sw_run <= 1;
|
pgm_sw_run <= 1;
|
Line 462... |
Line 472... |
state <= `state_write_gs_1;
|
state <= `state_write_gs_1;
|
end
|
end
|
end
|
end
|
|
|
`cmd_read_acc: begin
|
`cmd_read_acc: begin
|
|
busy <= 1;
|
|
state <= `state_read_acc_1;
|
end
|
end
|
|
|
`cmd_read_dist: begin
|
`cmd_read_dist: begin
|
|
busy <= 1;
|
|
state <= `state_read_dist_1;
|
end
|
end
|
|
|
`cmd_read_prog: begin
|
`cmd_read_prog: begin
|
|
busy <= 1;
|
|
state <= `state_read_prog_1;
|
end
|
end
|
|
|
// 0 : Ignore if not in manual
|
// 0 : Ignore if not in manual
|
// Clear gs_ram_addr
|
// Clear gs_ram_addr
|
// 1 : Synchronize with d10
|
// 1 : Synchronize with d10
|
Line 763... |
Line 778... |
state <= `state_write_gs_3;
|
state <= `state_write_gs_3;
|
digit_ready <= 0;
|
digit_ready <= 0;
|
end
|
end
|
end
|
end
|
|
|
|
`state_write_gs_2a: begin
|
|
if (d9) begin
|
|
digit_ready <= 1;
|
|
state <= `state_write_gs_3;
|
|
end
|
|
end
|
|
|
`state_write_gs_3: begin
|
`state_write_gs_3: begin
|
if (d10) begin
|
if (d10) begin
|
gs_ram_addr <= gs_word_addr;
|
gs_ram_addr <= gs_word_addr;
|
digit_ready <= 1;
|
digit_ready <= 1;
|
state <= `state_write_gs_4;
|
state <= `state_write_gs_4;
|
Line 774... |
Line 796... |
end
|
end
|
|
|
`state_write_gs_4: begin
|
`state_write_gs_4: begin
|
write_gs <= 1;
|
write_gs <= 1;
|
console_out <= cmd_digit_in;
|
console_out <= cmd_digit_in;
|
|
if (write_gs)
|
gs_ram_addr <= (gs_ram_addr + 1) % 32768;
|
gs_ram_addr <= (gs_ram_addr + 1) % 32768;
|
if (d10) begin
|
if (d10) begin
|
digit_ready <= 0;
|
digit_ready <= 0;
|
state <= `state_write_gs_5;
|
state <= `state_write_gs_5;
|
end
|
end
|
Line 786... |
Line 809... |
`state_write_gs_5: begin
|
`state_write_gs_5: begin
|
write_gs <= 0;
|
write_gs <= 0;
|
state <= `state_idle;
|
state <= `state_idle;
|
end
|
end
|
|
|
|
`state_read_acc_1: begin
|
|
if (wl & d10) begin
|
|
state <= `state_read_acc_2;
|
|
end
|
|
end
|
|
|
|
`state_read_acc_2: begin
|
|
digit_ready <= 1;
|
|
cmd_digit_out <= acc_ontime;
|
|
if (wu & d10) begin
|
|
state <= `state_read_acc_3;
|
|
end
|
|
end
|
|
|
|
`state_read_acc_3: begin
|
|
digit_ready <= 0;
|
|
state <= `state_idle;
|
|
end
|
|
|
|
`state_read_dist_1: begin
|
|
if (d10) begin
|
|
state <= `state_read_dist_2;
|
|
end
|
|
end
|
|
|
|
`state_read_dist_2: begin
|
|
digit_ready <= 1;
|
|
cmd_digit_out <= dist_ontime;
|
|
if (d10) begin
|
|
state <= `state_read_dist_3;
|
|
end
|
|
end
|
|
|
|
`state_read_dist_3: begin
|
|
digit_ready <= 0;
|
|
state <= `state_idle;
|
|
end
|
|
|
|
`state_read_prog_1: begin
|
|
if (d10) begin
|
|
state <= `state_read_prog_2;
|
|
end
|
|
end
|
|
|
|
`state_read_prog_2: begin
|
|
digit_ready <= 1;
|
|
cmd_digit_out <= prog_ontime;
|
|
if (d10) begin
|
|
state <= `state_read_prog_3;
|
|
end
|
|
end
|
|
|
|
`state_read_prog_3: begin
|
|
digit_ready <= 0;
|
|
state <= `state_idle;
|
|
end
|
|
|
// 0 : Ignore if not in manual
|
// 0 : Ignore if not in manual
|
// 1 : Synchronize with dx
|
// 1 : Synchronize with dx
|
// Put first dx digit
|
// Put first dx digit
|
// 2 : Put a digit:
|
// 2 : Put a digit:
|
// dx: blank
|
// dx: blank
|