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] AMS simulation of D-FF

Status
Not open for further replies.

Chinmaye

Full Member level 3
Joined
Jan 18, 2016
Messages
164
Helped
0
Reputation
0
Reaction score
1
Trophy points
1,298
Activity points
3,145
Hello all,
I am unable to simulate D-flipflop properly in AMS. The input that i am giving is itself shown incorrect on the wave form window. I was able to simulate simple gates but find ing problems with D flip flop. Attaching the code and waveform.

Code:
module DFF_VERI(D,clk,Q);
input D; // Data input 
input clk; // clock input 
output reg Q; // output Q 
always @(posedge clk) 
begin
 Q = D; 
end 

endmodule
 

Attachments

  • waveform.png
    waveform.png
    150.2 KB · Views: 131

There's no clock signal fed to your circuit, respectively output is uninitialized..

Confusingly you are providing a multi level ("electrical") signal to the D input which makes no sense for a D-FF.
 

The module has no reset and no special-case initialization code,
so there will be some problems getting an initial solution.


Here's code for a well-used veriloga DFF from a CMOS standard
cell library:



Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// VerilogA for dffr
// active-low reset, positive-edge clock
 
`include "constants.h"
`include "discipline.h"
 
module dffr ( data, reset, clk, vdd, vss, q);
input data,reset,clk,vdd,vss;
output q;
voltage data, reset, clk, vdd, vss, q;
real vth, qx;
integer logicd, logicr;
 
analog begin
 
  vth=(V(vdd)+V(vss))*0.5;
  logicr = V(reset) > vth;
  @ (cross(V(clk) - vth,1)) logicd = V(data) > vth;
  logicd = logicd * logicr;
  qx=(logicd) ? V(vdd) : V(vss);
  
 
  V(q) <+ transition(qx,1.5n,200p,200p);
 
end
endmodule

 
Last edited by a moderator:
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top