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

Subversion Repositories eco32

[/] [eco32/] [trunk/] [fpga/] [mc/] [src/] [kbd/] [keyboard.v] - Diff between revs 288 and 290

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 288 Rev 290
Line 1... Line 1...
//
//
// keyboard.v -- PC keyboard receiver
// keyboard.v -- PC keyboard receiver
//
//
 
 
 
 
 
`timescale 1ns/10ps
 
`default_nettype none
 
 
 
 
module keyboard(ps2_clk, ps2_data,
module keyboard(ps2_clk, ps2_data,
                clk, reset,
                clk, rst,
                keyboard_data, keyboard_rdy);
                keyboard_data, keyboard_rdy);
    input ps2_clk;
    input ps2_clk;
    input ps2_data;
    input ps2_data;
    input clk;
    input clk;
    input reset;
    input rst;
    output [7:0] keyboard_data;
    output [7:0] keyboard_data;
    output keyboard_rdy;
    output keyboard_rdy;
 
 
  reg ps2_clk_p;
  reg ps2_clk_p;
  reg ps2_clk_s;
  reg ps2_clk_s;
Line 51... Line 55...
    (ps2_clk_s == 1) ? ps2_clk_int_r + 1 :
    (ps2_clk_s == 1) ? ps2_clk_int_r + 1 :
    ps2_clk_int_r - 1;
    ps2_clk_int_r - 1;
 
 
  // clock level detector with hysteresis
  // clock level detector with hysteresis
  always @(posedge clk) begin
  always @(posedge clk) begin
    if (reset == 1) begin
    if (rst) begin
      ps2_clk_lvl_prv <= 1;
      ps2_clk_lvl_prv <= 1;
      ps2_clk_lvl <= 1;
      ps2_clk_lvl <= 1;
    end else begin
    end else begin
      ps2_clk_lvl_prv <= ps2_clk_lvl;
      ps2_clk_lvl_prv <= ps2_clk_lvl;
      if (ps2_clk_int_r == 4'b0100) begin
      if (ps2_clk_int_r == 4'b0100) begin
Line 102... Line 106...
      bitcnt_r != 4'b1011 &&
      bitcnt_r != 4'b1011 &&
      bitcnt_r != 4'b0000)) ? 1 : err_r;
      bitcnt_r != 4'b0000)) ? 1 : err_r;
 
 
  // update state registers
  // update state registers
  always @(posedge clk) begin
  always @(posedge clk) begin
    if (reset == 1 || err_r == 1) begin
    if (rst | err_r) begin
      ps2_clk_int_r <= 4'b1111;
      ps2_clk_int_r <= 4'b1111;
      data_r <= 10'b0000000000;
      data_r <= 10'b0000000000;
      timer_r <= 13'b0000000000000;
      timer_r <= 13'b0000000000000;
      bitcnt_r <= 4'b0000;
      bitcnt_r <= 4'b0000;
      rdy_r <= 0;
      rdy_r <= 0;

powered by: WebSVN 2.1.0

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