The Designer's Guide Community Forum
https://designers-guide.org/forum/YaBB.pl
Design Languages >> Verilog-AMS >> bidirectionnal switch with wreal inout in VAMS
https://designers-guide.org/forum/YaBB.pl?num=1299243756

Message started by idriss on Mar 4th, 2011, 5:02am

Title: bidirectionnal switch with wreal inout in VAMS
Post by idriss on Mar 4th, 2011, 5:02am

Hi Guys

I would like to model a Switch in verilogams using wreals,
I have 2 inouts wreals A and B, with an On and the thing is the switch is bidirectional, it means the signal can go from A to B or from B to A, in verilog you have specific function to do that, but for wreal is someone knows  or have an idea how to that?

Thank you very much
Idris

Title: Re: bidirectionnal switch with wreal inout in VAMS
Post by Marq Kole on Mar 7th, 2011, 7:21am

Hi Idriss,

The big difference between normal Verilog signals and wreal is that there is no standard resolution function for wreal. Cadence has created a few proprietary extensions that can help you to make bidirectional wreal ports.


Code:
module switch(a, b, s);
 inout a, b;
 input s;
 wreal a, b;
 wire s;

 real sigA, sigB;

 always @(a or b or s) begin
   sigA = a;
   sigB = b;
   if (s == 1'b1)
     case (1)
     (a === `wrealZState && b !== `wrealZState)
       sigA = b;
     (a !== `wrealZState && b === `wrealZState)
       sigB = a;
     endcase
 end

 assign a = sigA;
 assign b = sigB;

endmodule


This is the general idea, anyway. I have not actually tested the above code, I'll leave that up to you. The whole point here is that the special symbols `wrealZState and `wrealXState are used to make the wreals behave similar to other four-state logic in Verilog.

Cheers,
Marq

The Designer's Guide Community Forum » Powered by YaBB 2.2.2!
YaBB © 2000-2008. All Rights Reserved.