Line 35... |
Line 35... |
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, d10,
|
input wu, hp,
|
input wu, 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,
|
input [0:6] cmd_digit_in, io_buffer_in, gs_in, acc_ontime, dist_ontime,
|
|
prog_ontime,
|
input [0:5] command,
|
input [0:5] command,
|
|
|
output reg[0:6] data_out, addr_out, console_out,
|
output reg[0:6] data_out, addr_out, console_out,
|
|
output [0:6] display_digit,
|
output reg console_to_addr,
|
output reg console_to_addr,
|
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,
|
Line 69... |
Line 71... |
assign run_control = disp_sw_lacc | disp_sw_uacc | disp_sw_dist | disp_sw_pgm;
|
assign run_control = disp_sw_lacc | disp_sw_uacc | disp_sw_dist | disp_sw_pgm;
|
assign half_or_pgm_stop = half_cycle_sw_half | pgm_stop;
|
assign half_or_pgm_stop = half_cycle_sw_half | pgm_stop;
|
assign ri_storage = disp_sw_ri;
|
assign ri_storage = disp_sw_ri;
|
assign ro_storage = disp_sw_ro;
|
assign ro_storage = disp_sw_ro;
|
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
|
|
: (disp_sw_dist | disp_sw_ri | disp_sw_ro)? dist_ontime
|
|
: disp_sw_pgm? prog_ontime
|
|
: `biq_blank;
|
|
|
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
// 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 128... |
Line 134... |
`define state_write_gs_5 6'd40
|
`define state_write_gs_5 6'd40
|
`define state_clear_drum_1 6'd41
|
`define state_clear_drum_1 6'd41
|
`define state_clear_drum_2 6'd42
|
`define state_clear_drum_2 6'd42
|
`define state_clear_drum_3 6'd43
|
`define state_clear_drum_3 6'd43
|
`define state_load_gs_1 6'd44
|
`define state_load_gs_1 6'd44
|
`define state_load_gs_1 6'd45
|
`define state_load_gs_2 6'd45
|
|
`define state_dump_gs_1 6'd46
|
|
`define state_dump_gs_2 6'd47
|
|
`define state_dump_gs_3 6'd48
|
|
`define state_dump_gs_4 6'd49
|
|
|
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;
|
Line 450... |
Line 460... |
if (ctl_sw_manual) begin
|
if (ctl_sw_manual) begin
|
busy <= 1;
|
busy <= 1;
|
state <= `state_write_gs_1;
|
state <= `state_write_gs_1;
|
end
|
end
|
end
|
end
|
end
|
|
|
|
`cmd_read_acc: begin
|
`cmd_read_acc: begin
|
|
|
end
|
end
|
|
|
Line 487... |
Line 496... |
digit_ready <= 1;
|
digit_ready <= 1;
|
end
|
end
|
end
|
end
|
|
|
`cmd_dump_gs: begin
|
`cmd_dump_gs: begin
|
|
if (ctl_sw_manual) begin
|
|
busy <= 1;
|
|
state <= `state_dump_gs_1;
|
|
end
|
end
|
end
|
|
|
`cmd_power_on_reset: begin
|
`cmd_power_on_reset: begin
|
busy <= 1;
|
busy <= 1;
|
do_power_on_reset <= 1;
|
do_power_on_reset <= 1;
|
Line 701... |
Line 714... |
end
|
end
|
end
|
end
|
|
|
`state_read_gs_4: begin
|
`state_read_gs_4: begin
|
state <= `state_read_gs_5;
|
state <= `state_read_gs_5;
|
gs_ram_addr <= gs_ram_addr + 1;
|
gs_ram_addr <= (gs_ram_addr + 1) % 32768;
|
end
|
end
|
|
|
`state_read_gs_5: begin
|
`state_read_gs_5: begin
|
digit_ready <= 1;
|
digit_ready <= 1;
|
cmd_digit_out <= gs_in;
|
cmd_digit_out <= gs_in;
|
gs_ram_addr <= gs_ram_addr + 1;
|
gs_ram_addr <= (gs_ram_addr + 1) % 32768;
|
if (dx) begin
|
if (dx) begin
|
state <= `state_read_gs_6;
|
state <= `state_read_gs_6;
|
read_gs <= 0;
|
read_gs <= 0;
|
end
|
end
|
end
|
end
|
Line 761... |
Line 774... |
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;
|
gs_ram_addr <= gs_ram_addr + 1;
|
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
|
end
|
end
|
Line 774... |
Line 787... |
write_gs <= 0;
|
write_gs <= 0;
|
state <= `state_idle;
|
state <= `state_idle;
|
end
|
end
|
|
|
// 0 : Ignore if not in manual
|
// 0 : Ignore if not in manual
|
// Clear gs_ram_addr
|
// 1 : Synchronize with dx
|
// 1 : Synchronize with d10
|
// Put first dx digit
|
// Turn on console_write_gs
|
|
// 2 : Put a digit:
|
// 2 : Put a digit:
|
// dx: blank
|
// dx: blank
|
// d0: minus
|
// d0: minus
|
// d1-d10: zero
|
// d1-d10: zero
|
// gs_ram_addr++
|
|
`state_clear_drum_1: begin
|
`state_clear_drum_1: begin
|
if (d10) begin
|
if (dx) begin
|
console_out <= `biq_blank;
|
console_out <= `biq_blank;
|
gs_ram_addr <= 15'd0;
|
gs_ram_addr <= 15'd0;
|
write_gs <= 1;
|
write_gs <= 1;
|
state <= `state_clear_drum_2;
|
state <= `state_clear_drum_2;
|
end
|
end
|
Line 795... |
Line 806... |
|
|
`state_clear_drum_2: begin
|
`state_clear_drum_2: begin
|
console_out <= dx? `biq_blank
|
console_out <= dx? `biq_blank
|
: d0? `biq_minus
|
: d0? `biq_minus
|
: `biq_0;
|
: `biq_0;
|
gs_ram_addr <= gs_ram_addr + 1;
|
gs_ram_addr <= (gs_ram_addr + 1) % 32768;
|
if (gs_ram_addr == 15'd23999) begin
|
if (gs_ram_addr == 15'd23999) begin
|
write_gs <= 0;
|
write_gs <= 0;
|
state <= `state_idle;
|
state <= `state_idle;
|
end
|
end
|
end
|
end
|
Line 810... |
Line 821... |
console_out <= cmd_digit_in;
|
console_out <= cmd_digit_in;
|
state <= `state_load_gs_2;
|
state <= `state_load_gs_2;
|
end
|
end
|
|
|
`state_load_gs_2: begin
|
`state_load_gs_2: begin
|
gs_ram_addr <= gs_ram_addr + 1;
|
gs_ram_addr <= (gs_ram_addr + 1) % 32768;
|
console_out <= cmd_digit_in;
|
console_out <= cmd_digit_in;
|
if (gs_ram_addr == 15d'23999) begin
|
if (gs_ram_addr == 15'd23999) begin
|
write_gs <= 0;
|
write_gs <= 0;
|
digit_ready <= 0;
|
digit_ready <= 0;
|
state <= `state_idle;
|
state <= `state_idle;
|
end
|
end
|
end
|
end
|
|
|
|
`state_dump_gs_1: begin
|
|
gs_ram_addr <= 15'd0;
|
|
read_gs <= 1;
|
|
state <= `state_dump_gs_2;
|
|
end
|
|
|
|
`state_dump_gs_2: begin
|
|
gs_ram_addr <= (gs_ram_addr + 1) % 32768;
|
|
state <= `state_dump_gs_3;
|
|
end
|
|
|
|
`state_dump_gs_3: begin
|
|
digit_ready <= 1;
|
|
gs_ram_addr <= (gs_ram_addr + 1) % 32768;
|
|
cmd_digit_out <= gs_in;
|
|
if (gs_ram_addr == 15'd23999) begin
|
|
state <= `state_dump_gs_4;
|
|
end
|
|
end
|
|
|
|
`state_dump_gs_4: begin
|
|
digit_ready <= 0;
|
|
read_gs <= 0;
|
|
state <= `state_idle;
|
|
end
|
|
|
endcase;
|
endcase;
|
end
|
end
|
end;
|
end;
|
|
|
always @(posedge ap) begin
|
always @(posedge ap) begin
|