How to store integer string from keyboard on FPGA

Status
Not open for further replies.

koshmar29

Newbie level 4
Joined
Dec 15, 2014
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
36
Good evening,

I'm looking for a simple way to convert a sequence of keyboard strokes into a signed binary number I can use for processing. I understand how to convert scan codes into ascii/binary/bcd and how the keyboard works, but I'm having trouble when it comes to implementation. I'd like the input to be of unknown length--let's say up to 12 bits--and I'd like the input to be a signed whole integer, for simplicity. I tried searching for references, but I couldn't find anything specific to Verilog. In that regard, I'd greatly appreciate if anyone could give me advice on this matter.
 

First you have to convert the scan codes into the binary equivalent of the decimal number using a lookup table. That gets added to an accumulator. You'll need some method to clear the accumulator at the start of a new number. Each time you enter a new digit you will multiply the accumulator by 10 (too bad the number isn't hex) and add in the new number.

All of this should probably be contrrolled by an FSM.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…