Line 41... |
Line 41... |
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
//
|
//
|
// CVS Revision History
|
// CVS Revision History
|
//
|
//
|
// $Log: not supported by cvs2svn $
|
// $Log: not supported by cvs2svn $
|
|
// Revision 1.6 2003/05/28 16:27:09 simons
|
|
// Change the address width.
|
|
//
|
// Revision 1.5 2002/04/09 13:24:11 mihad
|
// Revision 1.5 2002/04/09 13:24:11 mihad
|
// Added mouse interface and everything for its handling, cleaned up some unused code
|
// Added mouse interface and everything for its handling, cleaned up some unused code
|
//
|
//
|
// Revision 1.4 2002/02/20 16:35:43 mihad
|
// Revision 1.4 2002/02/20 16:35:43 mihad
|
// Little/big endian changes continued
|
// Little/big endian changes continued
|
Line 85... |
Line 88... |
rx_scancode_i,
|
rx_scancode_i,
|
rx_kbd_data_ready_i,
|
rx_kbd_data_ready_i,
|
rx_kbd_read_o,
|
rx_kbd_read_o,
|
translate_o,
|
translate_o,
|
ps2_kbd_clk_i,
|
ps2_kbd_clk_i,
|
|
devide_reg_o,
|
inhibit_kbd_if_o
|
inhibit_kbd_if_o
|
`ifdef PS2_AUX
|
`ifdef PS2_AUX
|
,
|
,
|
wb_intb_o,
|
wb_intb_o,
|
|
|
Line 109... |
Line 113... |
wb_stb_i,
|
wb_stb_i,
|
wb_we_i ;
|
wb_we_i ;
|
|
|
input [3:0] wb_sel_i ;
|
input [3:0] wb_sel_i ;
|
|
|
input [2:0] wb_adr_i ;
|
input [3:0] wb_adr_i ;
|
|
|
input [31:0] wb_dat_i ;
|
input [31:0] wb_dat_i ;
|
|
|
output [31:0] wb_dat_o ;
|
output [31:0] wb_dat_o ;
|
|
|
Line 139... |
Line 143... |
output inhibit_kbd_if_o ;
|
output inhibit_kbd_if_o ;
|
|
|
reg [7:0] input_buffer,
|
reg [7:0] input_buffer,
|
output_buffer ;
|
output_buffer ;
|
|
|
reg [7:0] wb_dat_i_sampled ;
|
output [15:0] devide_reg_o;
|
|
reg [15:0] devide_reg;
|
|
assign devide_reg_o = devide_reg;
|
|
|
|
|
|
reg [15:0] wb_dat_i_sampled ;
|
always@(posedge wb_clk_i or posedge wb_rst_i)
|
always@(posedge wb_clk_i or posedge wb_rst_i)
|
begin
|
begin
|
if ( wb_rst_i )
|
if ( wb_rst_i )
|
wb_dat_i_sampled <= #1 0 ;
|
wb_dat_i_sampled <= #1 0 ;
|
else if ( wb_cyc_i && wb_stb_i && wb_we_i )
|
else if ( wb_cyc_i && wb_stb_i && wb_we_i )
|
wb_dat_i_sampled <= #1 wb_dat_i[31:24] ;
|
wb_dat_i_sampled <= #1 wb_dat_i[31:16] ;
|
end
|
end
|
|
|
`ifdef PS2_AUX
|
`ifdef PS2_AUX
|
output wb_intb_o ;
|
output wb_intb_o ;
|
reg wb_intb_o ;
|
reg wb_intb_o ;
|
Line 190... |
Line 199... |
wire perr = 1'b0 ;
|
wire perr = 1'b0 ;
|
|
|
wire [7:0] status_byte = {perr, timeout, aux_input_buffer_full, kbd_inhibit, a2, system_flag, output_buffer_full || aux_output_buffer_full, input_buffer_full} ;
|
wire [7:0] status_byte = {perr, timeout, aux_input_buffer_full, kbd_inhibit, a2, system_flag, output_buffer_full || aux_output_buffer_full, input_buffer_full} ;
|
|
|
reg read_input_buffer_reg ;
|
reg read_input_buffer_reg ;
|
wire read_input_buffer = wb_cyc_i && wb_stb_i && wb_sel_i[3] && !wb_ack_o && !read_input_buffer_reg && !wb_we_i && (wb_adr_i[2:0] == 3'h0) ;
|
wire read_input_buffer = wb_cyc_i && wb_stb_i && wb_sel_i[3] && !wb_ack_o && !read_input_buffer_reg && !wb_we_i && (wb_adr_i[3:0] == 4'h0) ;
|
|
|
reg write_output_buffer_reg ;
|
reg write_output_buffer_reg ;
|
wire write_output_buffer = wb_cyc_i && wb_stb_i && wb_sel_i[3] && !wb_ack_o && !write_output_buffer_reg && wb_we_i && (wb_adr_i[2:0] == 3'h0) ;
|
wire write_output_buffer = wb_cyc_i && wb_stb_i && wb_sel_i[3] && !wb_ack_o && !write_output_buffer_reg && wb_we_i && (wb_adr_i[3:0] == 4'h0) ;
|
|
|
reg read_status_register_reg ;
|
reg read_status_register_reg ;
|
wire read_status_register = wb_cyc_i && wb_stb_i && wb_sel_i[3] && !wb_ack_o && !read_status_register_reg && !wb_we_i && (wb_adr_i[2:0] == 3'h4) ;
|
wire read_status_register = wb_cyc_i && wb_stb_i && wb_sel_i[3] && !wb_ack_o && !read_status_register_reg && !wb_we_i && (wb_adr_i[3:0] == 4'h4) ;
|
|
|
reg send_command_reg ;
|
reg send_command_reg ;
|
wire send_command = wb_cyc_i && wb_stb_i && wb_sel_i[3] && !wb_ack_o && !send_command_reg && wb_we_i && (wb_adr_i[2:0] == 3'h4) ;
|
wire send_command = wb_cyc_i && wb_stb_i && wb_sel_i[3] && !wb_ack_o && !send_command_reg && wb_we_i && (wb_adr_i[3:0] == 4'h4) ;
|
|
|
|
reg write_devide_reg ;
|
|
wire write_devide = wb_cyc_i && wb_stb_i && wb_sel_i[3] && wb_sel_i[2] && !wb_ack_o && !write_devide_reg && wb_we_i && (wb_adr_i[3:0] == 4'h8) ;
|
|
reg read_devide_reg ;
|
|
wire read_devide = wb_cyc_i && wb_stb_i && wb_sel_i[3] && wb_sel_i[2] && !wb_ack_o && !read_devide_reg && !wb_we_i && (wb_adr_i[3:0] == 4'h8) ;
|
|
|
reg translate_o,
|
reg translate_o,
|
enable1,
|
enable1,
|
system,
|
system,
|
interrupt1 ;
|
interrupt1 ;
|
|
|
reg inhibit_kbd_if_o ;
|
reg inhibit_kbd_if_o ;
|
always@(posedge wb_clk_i or posedge wb_rst_i)
|
always@(posedge wb_clk_i or posedge wb_rst_i)
|
begin
|
begin
|
if ( wb_rst_i )
|
if ( wb_rst_i )
|
inhibit_kbd_if_o <= #1 1'b1 ;
|
inhibit_kbd_if_o <= #1 1'b0 ;
|
else if ( ps2_kbd_clk_i && rx_kbd_data_ready_i && !enable1)
|
else if ( ps2_kbd_clk_i && rx_kbd_data_ready_i && !enable1)
|
inhibit_kbd_if_o <= #1 1'b1 ;
|
inhibit_kbd_if_o <= #1 1'b1 ;
|
else if ( !rx_kbd_data_ready_i || enable1 )
|
else if ( !rx_kbd_data_ready_i || enable1 )
|
inhibit_kbd_if_o <= #1 1'b0 ;
|
inhibit_kbd_if_o <= #1 1'b0 ;
|
|
|
Line 246... |
Line 260... |
begin
|
begin
|
send_command_reg <= #1 1'b0 ;
|
send_command_reg <= #1 1'b0 ;
|
read_input_buffer_reg <= #1 1'b0 ;
|
read_input_buffer_reg <= #1 1'b0 ;
|
write_output_buffer_reg <= #1 1'b0 ;
|
write_output_buffer_reg <= #1 1'b0 ;
|
read_status_register_reg <= #1 1'b0 ;
|
read_status_register_reg <= #1 1'b0 ;
|
|
write_devide_reg <= #1 1'b0 ;
|
|
read_devide_reg <= #1 1'b0 ;
|
end
|
end
|
else
|
else
|
begin
|
begin
|
send_command_reg <= #1 send_command ;
|
send_command_reg <= #1 send_command ;
|
read_input_buffer_reg <= #1 read_input_buffer ;
|
read_input_buffer_reg <= #1 read_input_buffer ;
|
write_output_buffer_reg <= #1 write_output_buffer ;
|
write_output_buffer_reg <= #1 write_output_buffer ;
|
read_status_register_reg <= #1 read_status_register ;
|
read_status_register_reg <= #1 read_status_register ;
|
|
write_devide_reg <= #1 write_devide ;
|
|
read_devide_reg <= #1 read_devide ;
|
end
|
end
|
end
|
end
|
|
|
always@(posedge wb_clk_i or posedge wb_rst_i)
|
always@(posedge wb_clk_i or posedge wb_rst_i)
|
begin
|
begin
|
if ( wb_rst_i )
|
if ( wb_rst_i )
|
current_command <= #1 8'h0 ;
|
current_command <= #1 8'h0 ;
|
else if ( send_command_reg )
|
else if ( send_command_reg )
|
current_command <= #1 wb_dat_i_sampled ;
|
current_command <= #1 wb_dat_i_sampled[15:8] ;
|
end
|
end
|
|
|
reg current_command_valid,
|
reg current_command_valid,
|
current_command_returns_value,
|
current_command_returns_value,
|
current_command_gets_parameter,
|
current_command_gets_parameter,
|
Line 448... |
Line 466... |
end
|
end
|
|
|
reg [31:0] wb_dat_o ;
|
reg [31:0] wb_dat_o ;
|
wire wb_read = read_input_buffer_reg || read_status_register_reg ;
|
wire wb_read = read_input_buffer_reg || read_status_register_reg ;
|
|
|
wire [7:0] output_data = read_status_register_reg ? status_byte : input_buffer ;
|
wire [15:0] output_data = read_status_register_reg ? {2{status_byte}} : read_devide_reg ? devide_reg : {2{input_buffer}} ;
|
always@(posedge wb_clk_i or posedge wb_rst_i)
|
always@(posedge wb_clk_i or posedge wb_rst_i)
|
begin
|
begin
|
if ( wb_rst_i )
|
if ( wb_rst_i )
|
wb_dat_o <= #1 32'h0 ;
|
wb_dat_o <= #1 32'h0 ;
|
else if ( wb_read )
|
else if ( wb_read )
|
wb_dat_o <= #1 {4{output_data}} ;
|
wb_dat_o <= #1 {2{output_data}} ;
|
end
|
end
|
|
|
always@(posedge wb_clk_i or posedge wb_rst_i)
|
always@(posedge wb_clk_i or posedge wb_rst_i)
|
begin
|
begin
|
if ( wb_rst_i )
|
if ( wb_rst_i )
|
Line 484... |
Line 502... |
always@(posedge wb_clk_i or posedge wb_rst_i)
|
always@(posedge wb_clk_i or posedge wb_rst_i)
|
begin
|
begin
|
if ( wb_rst_i )
|
if ( wb_rst_i )
|
output_buffer <= #1 8'h00 ;
|
output_buffer <= #1 8'h00 ;
|
else if ( write_output_buffer_reg )
|
else if ( write_output_buffer_reg )
|
output_buffer <= #1 wb_dat_i_sampled ;
|
output_buffer <= #1 wb_dat_i_sampled[15:8];
|
|
end
|
|
|
|
always@(posedge wb_clk_i or posedge wb_rst_i)
|
|
begin
|
|
if ( wb_rst_i )
|
|
devide_reg <= #1 8'h00 ;
|
|
else if ( write_devide_reg )
|
|
devide_reg <= #1 wb_dat_i_sampled ;
|
end
|
end
|
|
|
always@(posedge wb_clk_i or posedge wb_rst_i)
|
always@(posedge wb_clk_i or posedge wb_rst_i)
|
begin
|
begin
|
if ( wb_rst_i )
|
if ( wb_rst_i )
|