norm() block in Simulink HDL coder

5 views (last 30 days)
DN
DN on 20 Jul 2016
Commented: DN on 20 Jul 2016
Hi, Does anyone know if there is a norm() block in HDL coder. I want to find the norm() of dt = norm(min(diff(t))); and I cant seem to find a Simulink HDL coder compatible block for this and not sure if I write a user defined function block for it whether norm() is supported, doesn't look like it from the documentation unless I'm missing something. I suppose one can probably code up the Euclidian distance formula, but I would have thought there is already something as simple as this in place. Thanks in advance.

Answers (1)

Tim McBrayer
Tim McBrayer on 20 Jul 2016
The short answer is no, HDL Coder does not support norm().
From the hardware perspective, the norm() function is a complicated function. It can involve taking a reciprocal, exponentiation, and absolute value, all on matrix values that could be real or complex numbers. Each of these operations involves tradeoffs (typically speed vs. area tradeoffs) when designing hardware to implement the function. HDL Coder customers typically will want control over the implementation of each of these sub-algorithms, so these sort of complicated algorithmic functions are not directly supported.
It appears straightforward to implement norm() in MATLAB code or in Simulink using basic blocks. This will give the designer full control over the hardware implementation of the algorithm.
  1 Comment
DN
DN on 20 Jul 2016
But the long answer is yes, you can by using user defined function block and putting it in there. (I understand why you didn't make a block because of the explanation above). Again just on linspace() yesterday, where I have variables within the linspace, do I use a function block or a constant block as you suggested but with the var names defined inside. You see my linspace looks like this, so a constant block wont work: logexp(linspace(ilogexp(max(5*dt)),ilogexp(1*T),M)); Many thanks

Sign in to comment.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!