#### Do you have a question? Post it now! No Registration Necessary

Re: Turn a divide into a multiply

This strikes me as an odd statement, since the whole point of

Bresenham's algorithm (which comes (approximately) from an era

when LSI meant having a whole four bit counter in one package)

is that it avoids division, ie if it uses division, it's not

Bresenham's

(and this thread is not the only place I've noticed this anomaly)

what is it evolving language? (I suppose you think a byte is 8 bits ;)

And as an aside/question,

isn't there a term applied to these stepwise ratiometric integer

calculations (other than Bresenham style or what ever)?

(there is but it escapes me)

bogax

Re: Turn a divide into a multiply

Neil...

I've never used the 8051, but have synthesized division using

multiplication. Can you specify number of bits for divisor and

dividend for me?

Is there a multiply operation that will handle divisor * quotient

as a single operation? What are timings for multiplication

operations? What are maximum multiplier/multiplicand/product sizes?

Is there a hard time requirement for each division or is it

necessary only to achive a sufficiently small average?

I've never used the 8051, but have synthesized division using

multiplication. Can you specify number of bits for divisor and

dividend for me?

Is there a multiply operation that will handle divisor * quotient

as a single operation? What are timings for multiplication

operations? What are maximum multiplier/multiplicand/product sizes?

Is there a hard time requirement for each division or is it

necessary only to achive a sufficiently small average?

--

Morris Dovey

West Des Moines, Iowa USA

Morris Dovey

West Des Moines, Iowa USA

We've slightly trimmed the long signature. Click to see the full one.

Re: Turn a divide into a multiply

On Sun, 3 Aug 2003 00:01:57 -0700, "Neil Bradley"

Zapped it into a simulator tonight, shaved another cycle, and

just tested the 32x16 divide routine using the algorithm I

posted here in C. Applied a variety of inputs and it always

beats 150us on your 18MHz system and always produces the right

results. Typically runs in about 144us. Could be faster with

a-priori information on your inputs, too.

Jon

Zapped it into a simulator tonight, shaved another cycle, and

just tested the 32x16 divide routine using the algorithm I

posted here in C. Applied a variety of inputs and it always

beats 150us on your 18MHz system and always produces the right

results. Typically runs in about 144us. Could be faster with

a-priori information on your inputs, too.

Jon

Re: Turn a divide into a multiply

If you can reorganise the data, you may be able to use simple bit shifts

to scale, multiply and divide by 2^n. I use this technique a lot to save

compute time and is very fast in either C or asm...

Chris

--

Aerosystem Designs

------------------

Aerosystem Designs

------------------

We've slightly trimmed the long signature. Click to see the full one.

Re: Turn a divide into a multiply

I jump in late, so maybe re-telling something one of the 40 posts

before did, but

If # of milliseconds is not growing endlessly, why not have a

table of 1/(# of ms) ?

=>

step = abs(DACstart-DACend)*reztab[# of milliseconds]

Getting this table is kinda tricky as you must ignore overflows.

But you can start and see what your compiler (gcc e.g. often uses

reciprokal) gives you for certain values.

---

42Bastian

Do not email to snipped-for-privacy@yahoo.com, it's a spam-only account :-)

42Bastian

Do not email to snipped-for-privacy@yahoo.com, it's a spam-only account :-)

We've slightly trimmed the long signature. Click to see the full one.

#### Site Timeline

- » Powering a LPC2114 ARM7
- — Next thread in » Embedded Programming

- » cs8900 not reciveing frames
- — Previous thread in » Embedded Programming

- » HD44780 / ST7066U Initialization
- — Newest thread in » Embedded Programming

- » Switcher Driving Motor for Speed Control
- — The site's Newest Thread. Posted in » Electronics Design

- » Active-HDL Throws Error
- — The site's Last Updated Thread. Posted in » Field-Programmable Gate Arrays