The input numbers of this calculator have a maximum of 5 digits, and the
recognition of the input number depends on how the keys are pressed by
the user.
If user first press 5 and "+" means user wants to add the one-digit
number 5 to the next number she wants to enter, but if user press 5,then
press 9, then press 1, then press "+" means user wants to add
three-digit number 591 to the next number she wants to enter.
Lothar M. wrote:> Fine that far.>> But whats the actual problem here? On what platform? With which> toolchain? In which language?
It takes a number from the input until an operator arrives and I do not
know how to tell this to the machine. exp) first press 5 second press 7
third press 4 fourth press "+" fiveth press 9 ==> 574 + 9
I want to implement on your Spartan7 discovery board with VHDL
Ali R. wrote:> It takes a number from the input
Which "input"? What is your input device? How do you determine a
"press"? May there be a "bouncing", so that you must debeounce the input
singals? How do you come from a "press" to a input value?
> and I do not know how to tell this to the machine
How would you do it on a sheet of paper? What steps are necessary? How
do you com from "first press 5 second press 7 third press 4" to a number
"574"? What can be the maximum number? What if someone presses more
keys?
> fourth press "+"
Are there other operators possible here?
Try to answer those qouestions. You will have to anyway, if not now,
then later on...
Lothar M. wrote:> Ali R. wrote:>> It takes a number from the input> Which "input"? What is your input device? How do you determine a> "press"? May there be a "bouncing", so that you must debeounce the input> singals? How do you come from a "press" to a input value?>>> and I do not know how to tell this to the machine> How would you do it on a sheet of paper? What steps are necessary? How> do you com from "first press 5 second press 7 third press 4" to a number> "574"? What can be the maximum number? What if someone presses more> keys?>>> fourth press "+"> Are there other operators possible here?>> Try to answer those qouestions. You will have to anyway, if not now,> then later on...
1.Number between 0000 to 1111 is my input and independent these number
calculation make decision
0000 to 1001 == number
1010== "+"
1011=="-"
1100=="*"
1101=="/"
1110=="="
1111== nothing
And i press input on a keyboard.
2. Inputs in my system have a maximum 5 digit and I said each digit is 4
bit
3.I upload image with detail
4. And this operation display on 6 seven segment and 1 7seg for sign
result
Thanks
Ali R. wrote:> 1.Number between 0000 to 1111 is my input> And i press input on a keyboard.
Thats a 4 bit vector. And in real life the bits of a vector never ever
change at the precise same picosecond, so how do you validate the
vector? Is there an additional signal that tells you: "now, this is the
correct bit pattern"? Or do you have to say: "its a valid input when the
input value doesn't change for 100ms".
> 0000 to 1001 == number
That are BCD numbers (binary encoded decimals).
> 1010=="+"> 1011=="-"> 1100=="*"> 1101=="/"> 1110=="="> 1111== nothing> 2. Inputs in my system have a maximum 5 digit
So the numbers can range from 0 to 99999 and 99999*99999 is 999980001
and therfore to much for a integer, so you must do the calculations in a
vector. But thats also a problem for your calculator display, because
999980001 are 9 digits and thats to much for a 6 digit display...
> 3.I upload image with detail
What should be shown the display whan you enter
3434 - 1212 =
Or
1234 + 5678 - 1000 =
Or
1111 - 2222 = + 3333 =
You must answer this first, because you canot display + - * and / on a
7seg display.
The whole task is fairly demanding and tricky in the details. So fist
you must get some structure in the "big tasks" you have to solve: input
data, entering values, calculate result, display thingies. These "big
tasks" you have to subdivide in "small steps" you can handle in state
machines.
BTW: what background on VHDL do you have?
Lothar M. wrote:> Ali R. wrote:>> 1.Number between 0000 to 1111 is my input>> And i press input on a keyboard.> Thats a 4 bit vector. And in real life the bits of a vector never ever> change at the precise same picosecond, so how do you validate the> vector? Is there an additional signal that tells you: "now, this is the> correct bit pattern"? Or do you have to say: "its a valid input when the> input value doesn't change for 100ms".>>> 0000 to 1001 == number> That are BCD numbers (binary encoded decimals).>>> 1010=="+">> 1011=="-">> 1100=="*">> 1101=="/">> 1110=="=">> 1111== nothing>> 2. Inputs in my system have a maximum 5 digit> So the numbers can range from 0 to 99999 and 99999*99999 is 999980001> and therfore to much for a integer, so you must do the calculations in a> vector. But thats also a problem for your calculator display, because> 999980001 are 9 digits and thats to much for a 6 digit display...>>> 3.I upload image with detail> What should be shown the display whan you enter>> 3434 - 1212 =>> Or>> 1234 + 5678 - 1000 =>> Or>> 1111 - 2222 = + 3333 =>> You must answer this first, because you canot display + - * and / on a> 7seg display.>> The whole task is fairly demanding and tricky in the details. So fist> you must get some structure in the "big tasks" you have to solve: input> data, entering values, calculate result, display thingies. These "big> tasks" you have to subdivide in "small steps" you can handle in state> machines.>> BTW: what background on VHDL do you have?
1. before I said that input maximum have a 5 digit (each digit is 4 bit)
so each number of two number between range 0 to 999. following
a0 op b0
a1a0 op b0
a2a1a0 op b0
a0 op b1b0
a1a0 op b1b0
a0 op b2b1b0
op is + - / *
then a2a1a0, b2b1b0 max is 999
2. I no problem with VHDL but In this project I little confuse for
input.
I hope you understood my problem.
thanks a lot man
Ali R. wrote:> a0 op b2b1b0
That makes it somewhat easier, you can hndle the calculations with an
integer.
> op is + - / *
How do you display it on the 7seg display?
> but In this project I little confuse for input.
Where does the input come from and more: how do you validate it? If "no
key" is represented by "1111", then how do you come to a "0000" for a
zero? Because from "1111" you can get several steps of transistions:
"1111" -> "1011" -> 5ns -> "1001" -> 3ns -> "1000" -> 6ns -> "0000"
So which of this steps is the correct one?
Input is easy that far: you take a 20 bit vector and set it to x"FFFFF".
Then you and validate the input vector and start writing at the
leftmost "nibble" (= 4 bits). Then you validate the next input vector
digit insert it at the next nibble and so forth. So the input pattern
looks (in hex numbers) alike this when entering 1 2 3 + 4
FFFFF -> 1FFFF -> 12FFF -> 123FF -> 123AF -> 123A4
And on the display you see (_ = blank) this:
___ -> 1____ -> 12___ -> 123__ -> 123+_ -> 123+4
And when the key = is entered, then you start konverting the numbers to
integers, perform the desired calculation and convert it back in the
same 20 bits, because those 20 bits are also displayed in the 7seg
thoughout the whole work.
Lothar M. wrote:> Ali R. wrote:
1. op doesn't display on 7Seg and just display input number and result.
2. input comes from the keyboard.
3. in your example "1111" -> "1011" -> 5ns -> "1001" -> 3ns -> "1000" ->
6ns -> "0000" Should I use freq. divider?
4. I like your suggestion. you're a good man. that's Ok Ill try these
suggest
Ali R. wrote:> input comes from the keyboard.
What kind of keyboard gives you a kind of signal you describe? How do
you proof, that the input bit pattern from the keyboard is valid?
> Should I use freq. divider?
What should it be good for? You must somehow validate the input value.
Especially when it comes from a mechanical keyboard and is therefore
totally asynchronous to the FPGA clock.
> op doesn't display on 7Seg and just display input number and result.
Show some examples of calculatione to get an idea what should happen...
Lothar M. wrote:> What kind of keyboard gives you a kind of signal you describe? How do> you proof, that the input bit pattern from the keyboard is valid?
a keyboard or two key for enter 0 , 1
> What should it be good for? You must somehow validate the input value.> Especially when it comes from a mechanical keyboard and is therefore> totally asynchronous to the FPGA clock.
In my opinion with some flag I can validate the input value, but I not
sure
> Show some examples of calculatione to get an idea what should happen...
exp1) input (seven 7-seg := _) : 12+56 1_2_ --> 5_6_
result (seven 7-seg): (sign)_6_8_
exp2) input (seven 7-seg := _) : 102*3 1_0_2_ --> 3_
result (seven 7-seg): (sign)_3_0_6_
exp3) input (seven 7-seg := _) : 39*87 3_9_ --> 8_7_
result (seven 7-seg): (sign)_3_3_9_3_
exp4) input (seven 7-seg := _) : 912-2 9_1_2_ --> 2_
result (seven 7-seg): (sign)_9_1_0_