eddie
New Member
Offline
Posts: 7
|
Hi. New to Verilog-A hence having some problems. I get syntax errors on this code but helpfully it doesn't tell me what the problem is. Here is the code:
// VerilogA for SPAD_Models, Rspad, veriloga //
`define V1 -0.000; `define V2 -9.000; `define V3 -9.170; //Voltage Points [user entered] `define V4 -9.250; `define V5 -9.320; `define V6 -9.360; `define V7 -9.400;
`define I1 0.000; `define I2 3.49E-9; `define I3 1.67E-8; //Current Points [user entered] `define I4 6.62E-8; `define I5 2.70E-7; `define I6 6.62E-7; `define I7 1.39E-6; `include "disciplines.vams"
module Rspad(anode, cathode);
inout anode, cathode; electrical anode, cathode;
real v, r; //define variables used below
real RA, RB, RC, RD, RE, RF; RA = (`V2 - `V1) / (`I2 - `I1); RB = (`V3 - `V2) / (`I3 - `I2); RC = (`V4 - `V3) / (`I4 - `I3); RD = (`V5 - `V4) / (`I5 - `I4); RE = (`V6 - `V5) / (`I6 - `I5); RF = (`V7 - `V6) / (`I7 - `I6);
analog begin v = V(anode, cathode); //get voltage over component if (v < `V2) begin //conditional assignment of r r = RA; //voltage dependant end
else if (v < `V3) 22 begin r = RB; end
else if (v < `V4) begin r = RC; end
else if (v < `V5) begin r = RD; end
else if (v < `V6) begin r = RE; end
else begin r = RF; end
V(anode, cathode) = r*I(anode, cathode); //calculate voltage
end //end analog endmodule
I get the following syntax error: Line 58: "RA = <<--? (`V2 - `V1) / (`I2 - `I1);" The problem is mainly that I'm new to this language. Cheers. Ed
|