No of Pipeline Stages in Verilog coming from an m file (or latency)

Technical Source
2 min readJan 27, 2022

How does one find how many pipeline stages exist in the verilog file. Example, run the mdhlc_sobel filter example from the web site and just pushing the default buttons in work flow advisor I get the design to run fast exceeding my system requirements. However, I dont know how many pipeline registers were put in there. The verilog code seems to show 12–15 or more stages (not sure) but I cannot tell what the latency will be. Also, it is hard to see the structure/data flow in the verilog code due to the number of times variables change names and then are pipelined. Version is 2014a.

NOTE:-

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

The short answer is that the conversion of the original untimed MATLAB code to sequential HDL requires multiple clock cycles to implement. This is just part of the nature of the algorithm, so will vary depending upon the particular design. I’m not familiar with this particular example so I can’t say what causes the code to require conversion to sequential form like this.

For your question #1: HDL Coder is indicating that the generated HDL contains a latency of n cycles. With no explicit pipelining, the conversion of the algorithm from untimed MATLAB code to sequential HDL code requires n cycles to complete in HDL. You do not need to add explicit pipelining unless desired. The delays are not pipeline registers per se, but are required for the algorithmic conversion.

Question #2 is a more generalized FPGA design question. The ‘correct’ answer may depend upon your algorithm, your target device, synthesis tool, whether HDL Coder is using Distributed Pipelining, and many other factors. I don’t think that there is a hard and fast answer to this other than “whatever works well for your design environment”.

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.