OpenCores
URL https://opencores.org/ocsvn/zet86/zet86/trunk

Subversion Repositories zet86

[/] [zet86/] [trunk/] [soc/] [keyb/] [rtl/] [ps2_keyb.v] - Diff between revs 49 and 52

Show entire file | Details | Blame | View Log

Rev 49 Rev 52
Line 17... Line 17...
 *  You should have received a copy of the GNU General Public License
 *  You should have received a copy of the GNU General Public License
 *  along with Zet; see the file COPYING. If not, see
 *  along with Zet; see the file COPYING. If not, see
 *  <http://www.gnu.org/licenses/>.
 *  <http://www.gnu.org/licenses/>.
 */
 */
 
 
 
`include "defines.v"
 
 
`timescale 1ns/100ps
`timescale 1ns/100ps
 
 
`define TOTAL_BITS   11
`define TOTAL_BITS   11
`define RELEASE_CODE 16'hF0
`define RELEASE_CODE 16'hF0
`define LEFT_SHIFT   16'h12
`define LEFT_SHIFT   16'h12
`define RIGHT_SHIFT  16'h59
`define RIGHT_SHIFT  16'h59
 
 
module ps2_keyb (
module ps2_keyb (
 
`ifdef DEBUG
 
    output           rx_output_strobe,
 
    output           released,
 
    output           rx_shifting_done,
 
`endif
    // Wishbone slave interface
    // Wishbone slave interface
    input            wb_clk_i,
    input            wb_clk_i,
    input            wb_rst_i,
    input            wb_rst_i,
    output reg [7:0] wb_dat_o,   // scancode
    output reg [7:0] wb_dat_o,   // scancode
    output reg       wb_tgc_o,   // intr
    output reg       wb_tgc_o,   // intr
    input            wb_tgc_i,   // inta
 
 
 
    // PS2 PAD signals
    // PS2 PAD signals
    inout            ps2_clk_,
    inout            ps2_clk_,
    inout            ps2_data_
    inout            ps2_data_
  );
  );
Line 75... Line 81...
  parameter m1_tx_error_no_keyboard_ack = 8;
  parameter m1_tx_error_no_keyboard_ack = 8;
  parameter m1_tx_rising_edge_marker = 9;
  parameter m1_tx_rising_edge_marker = 9;
 
 
  // Nets and registers
  // Nets and registers
  wire rx_output_event;
  wire rx_output_event;
  wire rx_output_strobe;
 
  wire rx_shifting_done;
 
  wire tx_shifting_done;
  wire tx_shifting_done;
  wire timer_60usec_done;
  wire timer_60usec_done;
  wire timer_5usec_done;
  wire timer_5usec_done;
 
`ifndef DEBUG
 
  wire rx_output_strobe;
 
  wire rx_shifting_done;
  wire released;
  wire released;
 
`endif
  wire [6:0] xt_code;
  wire [6:0] xt_code;
 
 
  reg [3:0] bit_count;
  reg [3:0] bit_count;
  reg [3:0] m1_state;
  reg [3:0] m1_state;
  reg [3:0] m1_next_state;
  reg [3:0] m1_next_state;
Line 139... Line 145...
  // These are the "unlatched versions."
  // These are the "unlatched versions."
  //assign extended = (q[8:1] == `EXTEND_CODE) && rx_shifting_done;
  //assign extended = (q[8:1] == `EXTEND_CODE) && rx_shifting_done;
  assign released = (q[8:1] == `RELEASE_CODE) && rx_shifting_done;
  assign released = (q[8:1] == `RELEASE_CODE) && rx_shifting_done;
 
 
  // Behaviour
  // Behaviour
  // intr
  // wb_tgc_o
  always @(posedge wb_clk_i)
  always @(posedge wb_clk_i)
    wb_tgc_o <= wb_rst_i ? 1'b0
    wb_tgc_o <= wb_rst_i ? 1'b0 : rx_output_strobe;
      : ((rx_output_strobe & !wb_tgc_i) ? 1'b1
 
      : (wb_tgc_o ? !wb_tgc_i : 1'b0));
 
 
 
  // This is the shift register
  // This is the shift register
  always @(posedge wb_clk_i)
  always @(posedge wb_clk_i)
    if (wb_rst_i) q <= 0;
    if (wb_rst_i) q <= 0;
    //  else if (((m1_state == m1_rx_clk_h) && ~ps2_clk_s)
    //  else if (((m1_state == m1_rx_clk_h) && ~ps2_clk_s)

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.