Is this following code can be converted to Verilog HDL code?

1. Is this following code can be converted to Verilog HDL code?

Hi all,

I am trying to convert the following code into verilog... First i want to sure that the following MATLAB Code can be converted into Verilog HDL

%%%%%%%%%%%%
clc
clear all

[fname, path] = uigetfile('*.txt','Open data file');
patient_data = fname(1:end-4);

N = length(p);
sr = 100; % Sampling rate
t = (1:N)'/sr;
% -----------------------------------------------

% Finding all beats of 2nd derivative -------
dt = .5; % Minimal pulse period
d = 10*median(abs(f)); % Amplitude threshold
n = find(f(1:end-1)<d & f(2:end)>d);
n = n(diff(n)/sr>dt);

% Finding local minimums and maximums
for j = 1: length(n)-1
[Amax(j),ind] = max(f(n(j):n(j+1)));
imax(j) = n(j)-1+ ind;
[Amin(j),ind] = min(f(n(j):n(j+1)));
imin(j) = n(j)-1+ ind;
end
% -----------------------------------------------

% The median b/a parameter value is here
b_a = -median(Amin./Amax);

%%%%%%%%%%%%%%%

The deadline is very near so please help me to figure our whether it can be converted into Verilog . If possible how? If no then why?

Thanx •

2. Re: Is this following code can be converted to Verilog HDL code?

- What do you exactly mean with converted into Verilog HDL? Simulation or synthesize a hardware?
- Are you talking about using a Matlab code generator or designing generic HDL code?

If you target to generic Verilog, you'll mainly have to define code to calculate derivative, median etc. In Matlab these operators apply to full data structures. You need to perform the respective calculations per data element, most likely in a sequence, one element per clock cycle.

In case of Verilog for synthesis, suitable numeric formats must be selected, the file operation has to be replaced by an interface to a data source.

1 members found this post helpful. --[[ ]]--