微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微波和射频技术 > 电磁仿真讨论 > [Moved]: Verilog A code for Timer

[Moved]: Verilog A code for Timer

时间:03-30 整理:3721RD 点击:
Hello,

I am trying to write verilog-A code to model a circuit that acts as an analog timer.
By default, the output is High, when it receives start signal (positive edge), the output should be low for a constant time (say 10u seconds) then it goes HIGH again.

Here is the code, however it doesn't seem to work.
Any help?

Code:
// VerilogA for ELC612, Analog_Timer, veriloga

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

module Analog_Timer(start,Vout);

input start;
output Vout;
electrical start, Vout;

parameter real ton=1u;
parameter real Vmax=1.5;
parameter real vtrans_clk=1.65;
parameter real vlogic_high=3.3;
parameter real vlogic_low = 0;
parameter trise=200e-9;
parameter tfall=200e-9;
parameter real tdel = 0;
integer next,temp;

analog begin

@ (cross( V(start) - vtrans_clk, +1,1n )) beginnext = Sabstime ;temp= 	0;
end	

@ (timer(next)) temp= 1;


V(Vout) <+ transition( temp? vlogic_high: vlogic_low,			   tdel, trise, tfall );


end
endmodule

Code:
// VerilogA for ELC612, Analog_Timer, veriloga

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

module Analog_Timer(start,Vout);

input start;
output Vout;
electrical start, Vout;

parameter real ton=10u;
parameter real Vmax=1.5;
parameter real vtrans_clk=1.65;
parameter real vlogic_high=3.3;
parameter real vlogic_low = 0;
parameter trise=200e-9;
parameter tfall=200e-9;
parameter real tdel = 0;

integer temp;
real next;

analog begin
   @(initial_step) begin
      temp = 1;
      next = Sabstime;
   end //initial_step

   @(timer(next)) temp= 1;

   @( cross(V(start)-vtrans_clk, +1, 1n) ) begin
      temp = 0;
      next = Sabstime + ton;
   end //cross

   V(Vout) <+ transition( temp ? vlogic_high:vlogic_low,
                                    tdel, trise, tfall );

end //analog
endmodule

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top