1 / 7

Integer Square Root

Integer Square Root. Lecture L8.0. Integer Square Root. unsigned long sqrt(unsigned long a){ unsigned long square = 1; unsigned long delta = 3; while(square <= a){ square += delta; delta += 2; } return (delta/2 - 1); }. Integer Square Root.

ajesus
Download Presentation

Integer Square Root

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Integer Square Root Lecture L8.0

  2. Integer Square Root unsigned long sqrt(unsigned long a){ unsigned long square = 1; unsigned long delta = 3; while(square <= a){ square += delta; delta += 2; } return (delta/2 - 1); }

  3. Integer Square Root unsigned long sqrt(unsigned long a){ unsigned long square = 1; unsigned long delta = 3; while(square <= a){ square += delta; delta += 2; } return (delta/2 - 1); }

  4. Integer Square Root

  5. Datapath unsigned long sqrt(unsigned long a){ unsigned long square = 1; unsigned long delta = 3; while(square <= a){ square += delta; delta += 2; } return (delta/2 - 1); } • The following steps can be used to create a datapath for implementing an algorithm. • Draw a register (rectangular box with input at the top and output at the bottom) for each variable in the algorithm. For the algorithm in Listing 1 these would include a, square, delta, and outreg (for the return value). Each register will also have a reset, clock, and load inputs. When the reset signal is high, the output of the register will be a predetermined initial value. If the load signal is high, then on the next rising edge of the clock signal the input value will be loaded into the register and appear on the output. • Define combinational blocks to implement any necessary arithmetic or logical operation. • Connect the outputs of the registers to the inputs of the appropriate arithmetic and logical operations, and connect the outputs of the arithmetic and logical operations to the appropriate registers. Multiplexers can be used if the input to a register can come from more than one source.

  6. Lab 5

  7. State Diagrams unsigned long sqrt(unsigned long a){ unsigned long square = 1; unsigned long delta = 3; while(square <= a){ square += delta; delta += 2; } return (delta/2 - 1); }

More Related