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.

[SOLVED] [moved] Need help writing equations in Verilog A. My first code in Verilog A.

Status
Not open for further replies.

soursethi17

Newbie level 4
Joined
Mar 19, 2019
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
38
I want to write these 3 equations with one boundary condition assosciated. I have coded the same in matlab and it works fine. But here i have some problems, i want the function to return me an array of values so i can plot them. I used this approach in matlab. But in verilog i dont knw what idt and ddt returns, array or function of t...

eq 1 : d(w(t))/dt = [uv*Ron.I(t)]/D #uv,Ron,D are constant and I(t) = input current, From here i get array of W for different I(t) ( or maybe w(t) ..? )
#boundary condition of equation 1 is w(0)=1.5e-9
eq 2 : R = Ron*w(t)/D + Roff(1- w(t)/D)
eq 3 : V(t)=R*I(t);

Code:
Verilog A
[I]//Verilog a memristor model by Sourabh Sethi//

`include "disciplines.vams"
`include "constants.h"

//in outs

module Memristor_Linear(p, n);
input p;
output n;
electrical p,n;
ground gnd;

//parameters

parameter real D= 3e-9;
parameter real uv=1e-15;
parameter real Roff = 2e5;
parameter real Ron=100;
real w_temp;
real w;
real R;


//equations
analog begin[syntax=verilog][/syntax]
w_temp=(uv*Ron*I(p,n))/D;
w=idt(w_temp,1.5e-9);                                            //initial condition w at t=0 is 1.5e-9
[B][I]R=(Ron*w)/D + (Roff*(1-(w/D);                       //Error is in this line[/I]               
[I]V(p,n) <+ R*(I(p,n) ;                                           // and this[/I][/B]
end


endmodule[/I]


Error log :
ERROR (VACOMP-2259): "R=(Ron*w)/D + (Roff*(1-(w/D);<<--? "
"/home/2018_2/resistive_ram/memristor_debug/veriloga/veriloga.va", line
32: syntax error.
ERROR (VACOMP-2259): "V(p) <+ R*(I(n) ;<<--? "
"/home/2018_2/resistive_ram/memristor_debug/veriloga/veriloga.va", line
33: syntax error.
 

Re: Need help writing equations in Verilog A. My first code in Verilog A.

I m calculating a function and i want to make one dimensional array of it by giving small time steps. How to do it ?

- - - Updated - - -

analog
begin
k=uv*Ron/D;
w = idt((k * I(p,n)),0.5*D);
r1=(Ron*w/D);
k2= (1-w/D);
r2=Roff*k2;
R=(r1+r2);
V(p,n)<+r1*I(p,n);
V(p,n)<+r2*I(p,n);
//V(p,n) <+ R* I(p,n);
end

Fixed above errors by splitting the equation. But i am getting a straight like, but my R is not constant , its a varying function. How to declare R as varying function of w ?
 

Re: Need help writing equations in Verilog A. My first code in Verilog A.

After some discussion with my guide, i will not try V(t)=R(t) * I(t) approach. I will now investigate multiplication of one dimensional array of resistance (which i will import from matlab) with Current's one dimensional array. Will update soon.
 

Re: Need help writing equations in Verilog A. My first code in Verilog A.

Hi,
this is the Digital Design and Embedded Programming forum. You won't get any help here on VerilogA!

A Mod should be shifting this to the appropriate sub-forum.

Till then, hold on. ;-)
 
Re: Need help writing equations in Verilog A. My first code in Verilog A.

Array multiplication will be difficult as i need 1e5 sample size or more to get smooth curve.
I have solved above problem by trial and error and got hysteresis I-V plot in Verilog A.
Please contact me at [email address removed - reply on Edaboard for the benefit of others please]. Screenshot.png
 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top