There are 4 messages in this thread.
You are currently looking at messages 0 to 4.
Hello, i want to split a number for example 1234 in 4 numbers 1,2,3,4 witch is the best way to do it? i was thinking of using this code tmp := number; o4 := number mod 10; tmp := tmp-o4; o3 := number mod 100; tmp := tmp-o3; o3 := o3/10; o2 := number mod 1000; tmp := tmp-o2; o2 := o2/100; o1 := number /1000; but i get an error: ERROR:HDLParsers:808 -"D:/Work/fpga/projects/stopWatch/nr.vhd" Line 53. * can not have suchoperands in this context. 10x in advance --------------------------------------- Posted through http://www.FPGARelated.com
zanaticul wrote: > but i get an error: ERROR:HDLParsers:808 - > "D:/Work/fpga/projects/stopWatch/nr.vhd" Line 53. * can not have such > operands in this context. http://lmgtfy.com/?q=vhdl+stop+watch______________________________
On Jan 30, 1:34=A0pm, "zanaticul" <cosminc...@yahoo.com> wrote: > Hello, > > i want to split a number for example 1234 in 4 numbers 1,2,3,4 > witch is the best way to do it? If you're just looking to display the binary value in decimal, do a quick search for "binary to bcd converter" and you should find nice little serial implementations that let you digest a digit at a time out of the original binary number. The serial implementation is quite nice. Since visual representation of the numbers doesn't have to occur at 50 MHz, the serial implementation is usually quite adequate. The first google hit shows the process extremely well: http://www.engr.udayton.edu/faculty/jloomis/ece314/notes/devices/binary_to_= BCD/bin_to_BCD.html - John_H______________________________
On 30 Jan., 19:34, "zanaticul" <cosminc...@yahoo.com> wrote: > i was thinking of using this code > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tmp :=3D number; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 o4 :=3D number mod 10; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tmp :=3D tmp-o4; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 o3 :=3D number mod 100; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tmp :=3D tmp-o3; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 o3 :=3D o3/10; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 o2 :=3D number mod 1000; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tmp :=3D tmp-o2; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 o2 :=3D o2/100; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 o1 :=3D number /1000; =A0 =A0 > > but i get an error: ERROR:HDLParsers:808 - > "D:/Work/fpga/projects/stopWatch/nr.vhd" Line 53. * can not have such > operands in this context. And which line is line 53? I can't see any "*" in the code you presented. Kolja Sulimma______________________________