The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
May 8th, 2024, 1:39pm
Pages: 1
Send Topic Print
bidirectionnal switch with wreal inout in VAMS (Read 5346 times)
idriss
Junior Member
**
Offline



Posts: 14

bidirectionnal switch with wreal inout in VAMS
Mar 04th, 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
Back to top
 
 
View Profile   IP Logged
Marq Kole
Senior Member
****
Offline

Hmmm. That's
weird...

Posts: 122
Eindhoven, The Netherlands
Re: bidirectionnal switch with wreal inout in VAMS
Reply #1 - 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
Back to top
 
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2024 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.