Syllabus - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Syllabus

Description:

Title: Syllabus Author: Prakash Created Date: 5/3/1998 11:00:24 PM Document presentation format: On-screen Show (4:3) Company: Compaq Other titles – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 13
Provided by: prakash
Category:

less

Transcript and Presenter's Notes

Title: Syllabus


1
Keypad BFM
2
Keypad BFM
  • module keypad (ROW, COL)
  • input 30 ROW
  • output 30 COL

3
Keypad BFM (cont.)
  • parameter R1 8200
  • parameter R2 220
  • parameter C 0.025
  • initial
  • begin
  • for (i 0 i lt 16 i i1)
  • begin
  • keystatei 0
  • end
  • on_delay R2C(0.51)
  • off_delay R1C(0.51)
  • end
  • buffers buffs (COL, new_col)

4
Keypad BFM (cont.)
  • // bitwise ands
  • assign new_col30
  • ( (4(ROW0 1'b0) keystate30)
  • (4(ROW1 1'b0) keystate74)
  • (4(ROW2 1'b0) keystate118)
  • (4(ROW3 1'b0) keystate1512) )
  • wire row_test (ROW3 1'b0) // not used

5
Keypad BFM (cont.)
  • // keys task to define key states
  • // for 16 keys of keypad
  • task keys
  • input 30 key_no
  • input pressed
  • begin
  • keystatekey_no pressed
  • end
  • endtask
  • endmodule

6
Pressing a Key w/the BFM
  • Assume module keypad has instance name kp1.
  • Then, somewhere in the test module
  • define tb test_bench
  • tb.kp1.keys(4,1) //press 4th key
  • tb.kp1.keys(4,0) //release 4th
  • tb.kp1.keys(9,1) //press 9th key
  • tb.kp1.keys(9,0) //release 9th
  • tb.kp1.keys(7,1)
  • tb.kp1.keys(14,1)

7
Scanner Logic
  • Column signal rising delay is long due to pullup
    and switchinput buffer capacitance
  • Ghosting is possible if you sample keys too
    early
  • LFSR counter provides ghosting and debounce delay

8
Scanner Logic (2)
  • Scanning stops after key is debounced
  • KEY_RDY signal is asserted
  • KEY_RDY signal handshakes with KEY_RD_

9
Scanner Logic (3)
  • KEY_DATA is updated at the point of key debounce
    complete
  • KEY_DATA is driven to target system with encoded
    key data corresponding to pressed key while
    KEY_RD_ is asserted
  • Auto_read module generates KEY_RD_ read strobe
    when KEY_RDY is asserted
  • By connecting AUTO_RD_ to KEY_RD_, key data is
    automatically read after a key has been detected
  • Scanning resumes after key is read by host system

10
Using the Keypad BFM
  • Rows are sequentially driven either 0 or z
  • Columns are either 1 from pullup when no key is
    pressed or
  • 0 when key is pressed at intersection of row
    and column
  • keystate register defines pressed keys

11
Using the Keypad BFM (2)
  • BFM allows modeling multiple asserted keys
  • keystate is declared as 16 bit register - bits
    are assigned value of one when key is pressed
  • Bit 0 of 16-bit register corresponds to row/col
    00/00
  • Key positions 0-3 are on first row (row 0), key
    positions 4-7 are on second row (row 1), etc.

12
The End!
Write a Comment
User Comments (0)
About PowerShow.com