[go: nahoru, domu]

Skip to content

Commit

Permalink
Knowm Verilog cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
timmolter committed Jan 24, 2017
1 parent cb0644d commit a356392
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 31 deletions.
11 changes: 7 additions & 4 deletions Knowm/Verilog-A/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
|---|---|---|
|Ill-formed|Verilog-A|Xyce|

## Resources

1. [Build Xyce from Source for ADMS Verilog-A Model Integration](http://knowm.org/build-xyce-from-source-for-adms-verilog-a-model-integration/)
1. [Well-posed Memristor Modeling with Xyce and Verilog-A](http://knowm.org/well-posed-memristor-modeling-with-xyce-and-verilog-a/)

## Instructions

cd ~/workspaces/workspace_knowm/memristor-models-4-all/Metastable_Switch/Verilog-A
cd ~/workspaces/workspace_knowm/memristor-models-4-all/Knowm/Verilog-A
buildxyceplugin -o metastableswitch *.va /usr/local/lib
Xyce -plugin /usr/local/lib/metastableswitch.so memristor_sim.cir
gnuplot
plot '~/workspaces/workspace_knowm/memristor-models-4-all/Metastable_Switch/Verilog-A/memristor_sim.cir.prn' using 3:4 with lines title "I-V"
plot '~/workspaces/workspace_knowm/memristor-models-4-all/Knowm/Verilog-A/memristor_sim.cir.prn' using 3:4 with lines title "I-V"

## Note

This is a work in progress until Xyce/ADMS has implemented the `distNormal` function.
33 changes: 7 additions & 26 deletions Knowm/Verilog-A/memristor.va → Knowm/Verilog-A/knowm.va
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
`include "disciplines.vams"
`include "constants.vams"

`define X_BORDER_BUMP 10e-18

`define attr(txt) (*txt*)

module mssmemristor (p,n);
module knowmmemristor (p,n);

inout p,n;
electrical p,n;

parameter real G_OFF=1E-6 from (0:inf) `attr(info="G_OFF" type="instance");
parameter real G_ON=10E-6 from (0:inf) `attr(info="G_ON" type="instance");
parameter real V_ON=.2 from (0:inf) `attr(info="V_ON" type="instance");
parameter real R_OFF=1E-6 from (0:inf) `attr(info="R_OFF" type="instance");
parameter real R_ON=10E-6 from (0:inf) `attr(info="R_ON" type="instance");
parameter real V_OFF=.2 from (0:inf) `attr(info="V_OFF" type="instance");
parameter real TC=0.0001 from (0:inf) `attr(info="TC" type="instance");
parameter real N=10e5 from [0:inf) `attr(info="N" type="instance");
parameter real N_ON_OFF_RATIO=0 from [0:1] `attr(info="N_ON_OFF_RATIO" type="instance");
parameter real V_ON=.2 from (0:inf) `attr(info="V_ON" type="instance");
parameter real TAU=0.0001 from (0:inf) `attr(info="TAU" type="instance");
parameter real XO=0 from [0:1] `attr(info="XO" type="instance");
// TODO: use R_INIT instead of XO

// local variables that should persist over time steps
real g_off;
Expand Down Expand Up @@ -97,23 +95,6 @@ module mssmemristor (p,n);



num_ON_to_OFF= $dist_normal(1,0,1n,"global");



if(Pa > .6 && global_on < .5) begin
Nb = 0;
global_on = 1;
end
else if (Pb > .6 && global_on > .5) begin
Nb = N;
global_on = 0;
end







// conductance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
V1 1 0 SIN(0V .25V 100Hz)

* Memristors
YMSSMEMRISTOR M1 1 0
Yknowmmemristor M1 1 0

* Analysis Command
.TRAN .01ms 10ms
Expand Down
Binary file removed Knowm/Verilog-A/memristor_sim.png
Binary file not shown.

0 comments on commit a356392

Please sign in to comment.