Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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

Status
Not open for further replies.

marufsust

Newbie level 6
Joined
May 5, 2010
Messages
11
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Malaysia
Activity points
1,383
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

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

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

% Finding all beats of 2nd derivative -------
f = gradient(gradient(p));
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
 

- 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.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top