Im planning to do KNN's verilog implementation. But the problem is the euclidean distance measurement term associated with KNN,since it needs Subtraction,squaring,adding. I think,the code will become complex when i code knn with euclidean distance.Is there any simple method(hardware friendly) to find the distance, so that the complexity of the code and hence complexity of synthesized circuit will reduce. My idea is to store the codebook in memory and when we give input, k nearest neighbours index will generated as output.
Related Questions in VERILOG
- Error message coming up when compiling iVerilog Code
- Communicate/transfer data between two different programs. JAVA & VERILOG
- Spiking neural network on FPGA
- Matrix Multiplication Testbench Yields Inconsistent Results
- Formal verification of state machine with SymbiYosys not giving expected results
- How to compile only the changed files in Verilator?
- 4-bit ALU SLT operation
- How to connect combo code to a module's interface modport?
- 4-bit ALU using 1-bit ALU in verilog
- Is there a difference when using the ternary operator in always and assign statements?
- Verilog Implementation: Detecting Overflow and Rolling Up Result
- IO placement is infeasible error in Vivado
- How do I deploy this polynomial multiplication algorithm to verilog
- always block not always triggering at event
- Multiple modules in FSM and how it's working?
Related Questions in FPGA
- uart in vhdl send a string
- A FPGA Project Proposal where I can use both PS and PL
- IO placement is infeasible error in Vivado
- Why RTOS is needed for FPGA based real-time embedded system?
- Padding zeros with std_logic_vector results in Implementation Error
- How to write into 12 addresses at the same cycle in vivado and still be recognized as BRAM
- PLL not showing output on ModelSim
- Using FPGA to sample and filter audio based off switch selection
- Why is there no output from the verilog test bench?
- Freeze after two subsequent software resets for Zynq 7000 FPGA (with SoC)
- Verilog module always going to default case when assigning value to input
- Where do I find the Xilinx xc7z007sclg400-1 master constaint file?
- Failed to use memory bits in fpga
- How to increase baudrate on Device Manager Windows?
- Gate-Level Sim: Hold time violation between testbench and first registers?
Related Questions in KNN
- How does Elasticsearch do attribute filtering during knn (vector-based) retrieval?
- How to use query combined to KNN with ElasticSearch?
- The KNN model I am using is always coming back at 100% accuracy but it shouldn't be
- identify objects with 2 classes using knn and greyscale and display the appearance in the GUI
- KNN algorithm from OCR project having trouble with certain digits
- SOLR compatibility of the KNN query parser with function queries
- How to decrease too many False Positives I get from a KNN classifier for ECG R-peak detection?
- Inconsistent results when using KNN innerproduct scoring on OpenSearch depending on if a filter is set
- Python: Missing (Constant) Inaccuracy from knn_classifier() on eeg audio (X_train)
- Prediction Accuracy Zero (y_pred == y_test) & ValueError after Binary Projection, kNN Hamming, Xtrain/y_train appear accurate
- How to combine a column containing score value with knn score of rest of the columns
- R package 'BiocNeighbors' resturn different nearest neighbors with other packages (e.g., FNN package)
- Regression And Classification
- KNN Across categories in postgis using indexing
- knn manual calculation vs. R class package
Related Questions in EUCLIDEAN-DISTANCE
- Euclidean Distance between two vectors in two columns in spark data frme
- How to exclude double values in sklearn.metrics.pairwise.euclidean_distances results
- Iterate through ID-matched Euclidean distances using dist() in R
- Generate P random N-dimensional points from list of ALL possible pairwise distances
- Fast way to find closest line segment for a large set of planar points [Python]
- How to compute the Euclidean distance between two complex matrix by vectorization?
- Move point B to be between A and C while keeping the distance
- How to produce the indexes from pdist2 function in Octave?
- Pairing Test and Control Plots by Euclidean Distance of a Vector in R
- Finding a point close enough to a point
- finding distance between two object of an image with euclidean distance and opencv
- Computationally efficient way of calculating euclidean distance between points and nearest line on a landscape in R sf
- Minimum and Mean Euclidean distance between two tensors of different shape
- how to calculate a masked distance transform with ndimage.distance_transform_edt?
- Travelling Salesman Problem - Best path to go through all points
Related Questions in VLSI
- Are FPGA GPIOs capable enough to read bits at a high rate (26Mbps)? If not, what is a possible way?
- Shift and add binary multiplier getting don't-cares for reg2
- NgSpice Installation
- Possible algo or approach to solve this type of floorplanning problem?
- Why Ac_cdc01d rule in synopsis spyglass CDC is disabled by default?
- PRIMETIME | Issue linking hierarchal netlist
- The issue behind building a QuadTree
- Find total number of instances of a module from rtl without using tool (python)
- Expecting a SInt value from a Wire, in Chisel
- Convert lef-def layout to gds using klayout
- Error in the code I am unable to solve it and i am unable to prevent the error
- Filter out pins having same clock attribute
- Regarding "D0" drive strength cell
- STA of 2 clocks with the same frequency
- what does Innovus dbGet command top.insts.cell.baseClass mean ? what are these values of top.insts.cell.baseClass mean?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Finding the k-Nearest Neighbors involves two parts: 1) Calculate the distance between your input vector and every reference vector and 2) Find the k smallest distances.
For the part 1), you can design a pipelined Euclidean distance function that consists of a subtractor, multiplier, and accumulator. Subtraction and accumulation (addition) require a relatively small clock period relative to multiplication. Depending on the bitwidth it may be worthwhile to pipeline those as well. A single-cycle multiplier will require a prohibitively high clock period, so it will certainly have to be pipelined.
Here I've assumed you're working with integers; if you have to work with floating point then you're out of luck since floating point multiply and addition cannot be pipelined due to their divergent branching.
For part 2), you have to compare all of the distances to find the k smallest. This can be done several ways; one possible way is with a tree of comparators that finds the single smallest distance. Once that is found, you can remove that distance from the set of distances and repeat k times.
Notice that for part 1, you're basically implementing a CPU/GPU's functional unit; and that's almost certainly going to be faster than your Verilog implementation. The biggest improvement you'll get over a CPU/GPU is with part 2) finding the k minimum distances.