VHDL switch model #2

Dear All,
I have modified Ben Cohen's switch model code
(http://members.aol.com/vhdlcohen/vhdl/vhdlcode/switch1.vhd)
to handle multiple transactions occuring in delta times.
Could you please comment on this, are there any problems with the following
code?

Best regards,
GWJ

----------------------------------------------------------------------------
-- Copyright (c) 1997, Ben Cohen.   All rights reserved.
-- This model can be used in conjunction with the Kluwer Academic book
-- "VHDL Coding Styles and Methodologies", ISBN: 0-7923-9598-0
-- "VHDL Amswers to Frequently Asked Questions", Kluwer Academic
-- which discusses guidelines and testbench design issues.
--
-- This source file for the switch model may be used and
-- distributed without restriction provided that this copyright
-- statement is not removed from the file and that any derivative work
-- contains this copyright notice.

-- File name  : switch1.vhd
-- Description: This entity, and architecture provide
--   the definition of a three-port component (A, B, Cab) that models a
--   transfer gate.  If Cab = '1' then A and B act as an ON switch
--   (or zero ohm connection).  Else, if Cab = '0', then A and B are
--   assigned the value of 'Z'.
--
--   The width of the pass-through switch is defined through the
--   generic "width_g".  The pass-through control and operation
--   is defined on a per bit basis (i.e. one process per bit).
--
--=================================================================
-- Design Library: User defined.
-------------------------------------------------
-- Revisions:
--   Date   Author             Revision  Comment
-- 03-31-97 Ben Cohen          Rev A     Creation
--          VhdlCohen@aol.com
-- 09-13-03 Grzegorz Jablonski Rev B     Modified to handle multiple
transactions occuring in delta times
--          gwj@dmcs.p.lodz.pl
-------------------------------------------------------------
library IEEE;
  use IEEE.Std_Logic_1164.all;

-------------------------------------------------------------
-- Entity        : Switch1
-- Purpose       : Provides interface of a component
--               : intended to be placed between signals
--               : to dynamically control faults on signals.
-- Library       : User defined
-------------------------------------------------------------
library IEEE;
  use IEEE.Std_Logic_1164.all;

entity Switch1 is
  generic (Width_g      : Positive := 32);
  port
    (A   : inout Std_Logic_Vector(Width_g - 1 downto 0) := (others => 'Z');
     B   : inout Std_Logic_Vector(Width_g - 1 downto 0) := (others => 'Z');
     Cab : in    Std_Logic_Vector(Width_g - 1 downto 0) := (others => 'Z'));
end Switch1;


--------------------------------------------------------------
-- Architecture  : Switch1_a
-- Purpose       : Implements the switch architecture.
--               : This model is optimized for speed by minimizing the
--               : number of transactions by generating one process
--               : for each element of the width for the
--               : mode of interest.
-------------------------------------------------------------
architecture Switch1_a of Switch1 is
  type StdLogic_Table is array(Std_uLogic, Std_uLogic) of Std_uLogic;

  ------------------------------------------------------------------- 
  -- resolution function, from 1164 package body
  ------------------------------------------------------------------- 
  constant Resolution_Table : Stdlogic_Table := (
  --      ---------------------------------------------------------
  --      |  U    X    0    1    Z    W    L    H    -        |   |
  --      ---------------------------------------------------------
          ( 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U' ), -- | U |
          ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ), -- | X |
          ( 'U', 'X', '0', 'X', '0', '0', '0', '0', 'X' ), -- | 0 |
          ( 'U', 'X', 'X', '1', '1', '1', '1', '1', 'X' ), -- | 1 |
          ( 'U', 'X', '0', '1', 'Z', 'W', 'L', 'H', 'X' ), -- | Z |
          ( 'U', 'X', '0', '1', 'W', 'W', 'W', 'W', 'X' ), -- | W |
          ( 'U', 'X', '0', '1', 'L', 'W', 'L', 'W', 'X' ), -- | L |
          ( 'U', 'X', '0', '1', 'H', 'W', 'W', 'H', 'X' ), -- | H |
          ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' )  -- | - |
      );

  function Resolved ( S : Std_uLogic_Vector ) return Std_uLogic is
      variable Result : Std_uLogic := 'Z';  -- weakest state default
  begin
      -- the test for a single driver is essential otherwise the
      -- loop would return 'X' for a single driver of '-' and that
      -- would conflict with the value of a single driver unresolved
      -- signal.
      if    (S'length = 1) then
        return S(S'low);
      else
          for I in S'range Loop
              Result := Resolution_Table(Result, S(I));
          end loop;
      end if;
      return Result;
   end Resolved;

begin
  Px_Lbl: for I in (Width_g - 1) downto 0 generate
    ABC1_Lbl: process
      variable ThenTime_v : time;
      variable ResolvedValue_v : Std_uLogic;
   variable Cab_v : Std_Logic;
    begin
      wait on A(I)'transaction, B(I)'transaction, Cab(I)'transaction
   until (
              ThenTime_v /= now or Cab(I) /= Cab_v or
              (Cab(I) = '1' and (A(i)/=ResolvedValue_v or
B(i)/=ResolvedValue_v))
   );
      -- Break
      ThenTime_v := now;
      A(I) <= 'Z';
      B(I) <= 'Z';
      wait for 0 ns;
      Cab_v := Cab(I);
      if Cab(I) = '1' then
        -- Make.  Must compute the resolved value
        ResolvedValue_v  := Resolved((A(I), B(I)));
        A(I) <= ResolvedValue_v;
        B(I) <= ResolvedValue_v;

      else
          A(I) <= 'Z';
          B(I) <= 'Z';
      end if;
    end process ABC1_Lbl;
  end generate Px_Lbl;
end Switch1_a;


----------------------------------------------------------------------------
---
--  1 bit switch
----------------------------------------------------------------------------
---
library IEEE;
  use IEEE.Std_Logic_1164.all;

entity Switch1b is
  generic (Width_g      : Positive := 32);
  port
    (A   : inout Std_Logic := 'Z';
     B   : inout Std_Logic := 'Z';
     Cab : in    Std_Logic := 'Z');
end Switch1b;


--------------------------------------------------------------
-- Architecture  : Switch1b_a
-- Purpose       : Implements the switch architecture.
--               : This model is optimized for speed by minimizing the
--               : number of transactions by generating one process
--               : for each element of the width for the
--               : mode of interest.
-------------------------------------------------------------
architecture Switch1b_a of Switch1b is
  type StdLogic_Table is array(Std_uLogic, Std_uLogic) of Std_uLogic;

  ------------------------------------------------------------------- 
  -- resolution function
  ------------------------------------------------------------------- 
  constant Resolution_Table : Stdlogic_Table := (
  --      ---------------------------------------------------------
  --      |  U    X    0    1    Z    W    L    H    -        |   |
  --      ---------------------------------------------------------
          ( 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U', 'U' ), -- | U |
          ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' ), -- | X |
          ( 'U', 'X', '0', 'X', '0', '0', '0', '0', 'X' ), -- | 0 |
          ( 'U', 'X', 'X', '1', '1', '1', '1', '1', 'X' ), -- | 1 |
          ( 'U', 'X', '0', '1', 'Z', 'W', 'L', 'H', 'X' ), -- | Z |
          ( 'U', 'X', '0', '1', 'W', 'W', 'W', 'W', 'X' ), -- | W |
          ( 'U', 'X', '0', '1', 'L', 'W', 'L', 'W', 'X' ), -- | L |
          ( 'U', 'X', '0', '1', 'H', 'W', 'W', 'H', 'X' ), -- | H |
          ( 'U', 'X', 'X', 'X', 'X', 'X', 'X', 'X', 'X' )  -- | - |
      );

  function Resolved ( S : Std_uLogic_Vector ) return Std_uLogic is
      variable Result : Std_uLogic := 'Z';  -- weakest state default
  begin
      -- the test for a single driver is essential otherwise the
      -- loop would return 'X' for a single driver of '-' and that
      -- would conflict with the value of a single driver unresolved
      -- signal.
      if    (S'length = 1) then
        return S(S'low);
      else
          for I in S'range Loop
              Result := Resolution_Table(Result, S(I));
          end loop;
      end if;
      return Result;
   end Resolved;

begin
    ABC1_Lbl: process
      variable ThenTime_v : time;
      variable ResolvedValue_v : Std_uLogic;
   variable Cab_v : Std_Logic;
    begin
      wait on A'transaction, B'transaction, Cab'transaction
   until (
              ThenTime_v /= now or Cab /= Cab_v or
              (Cab = '1' and (A/=ResolvedValue_v or B/=ResolvedValue_v))
   );
      -- Break
      ThenTime_v := now;
      A <= 'Z';
      B <= 'Z';
      wait for 0 ns;
      Cab_v := Cab;
      if Cab = '1' then
        -- Make.  Must compute the resolved value
        ResolvedValue_v  := Resolved((A, B));
        A <= ResolvedValue_v;
        B <= ResolvedValue_v;

      else
          A <= 'Z';
          B <= 'Z';
      end if;
    end process ABC1_Lbl;
end Switch1b_a;





0
gwj (1)
9/13/2003 10:21:17 AM
comp.lang.vhdl 6336 articles. 14 followers. Post Follow

0 Replies
201 Views

Similar Articles

[PageSpeed] 58
Reply:
Similar Artilces:

What is sysServices value of Cisco switch 2948G..Urgent.pls help...
i know the following sysServices:: A value which indicates the set of services that this entity primarily offers. The value is a sum. This sum initially takes the value zero, Then, for each layer, L, in the range 1 through 7, that this node performs transactions for, 2 raised to (L - 1) is added to the sum. For example, a node which performs primarily routing functions would have a value of 4 (2^(3-1)). In contrast, a node which is a host offering application services would have a value of 72 (2^(4-1) + 2^(7-1)). Note that in the context of the Internet suite of protocols, values should be ca...

Re: A SAS patch changed the way PROC SQL worked and changed the #2
Guido: I don't have a sensible explanation of how SAS SQL decides to collapse rows in a GROUP BY query, and why it does some times and not others. Calculating or renaming of columns in a GROUP BY clause tends to inhibit collapsing of rows in summaries. In the case you present, the alias for s in the select statement would be difficult for the SQL compiler to relate back to the s in the GROUP BY clause. Make your intent more obvious to the SQL compiler with the DISTINCT keyword following SELECT. In a query language that conforms to the relational model, the duplicated rows should not appea...

new user #2
Hi ! This is my first message . I new here . I like python , blender 3d and opengl and is a hobby for me. I have a site www.catalinfest.xhost.ro where i write about me and python , blender ... I hope learning more on this group . Have a nice day ! ...

Re: Does anyone have an extra one of these? #2
Hi Ron, we have 3 types of 28685B style transceivers for 10 bucks each, I have several of tnem, they perform the same function as the 28685B. Feel free to contact me if you want one. Jesse Cypress Tech * To join/leave the list, search archives, change list settings, * * etc., please visit http://raven.utc.edu/archives/hp3000-l.html * ...

Is there a way to define different names to same signal in VHDL?
I'm looking for a method to use substitute names to same signal VHDL so the synthesis tool would use the same flops for all of them.... is there a way to do it right? Thanx On 10 Aug, 08:50, Eli <eli.h...@gmail.com> wrote: > I'm looking for a method to use substitute names to same signal VHDL > so the synthesis tool would use the same flops for all of them.... is > there a way to do it right? > > Thanx it should already do this, for example: signal reg : std_logic; signal a,b,c : std_logic; process(clk) begin if rising_edge(clk) then reg <= input; e...

Problems in switching between Macs
Last week I was out of town at a conference, so I copied all my Eudora folders from my Power Mac to my MacBook. I had no problems sending or receiving mail that week. When I got home, I copied the updated folders back to my Power Mac. All was fine for a couple of days, but I just realized a few minutes ago that Eudora hadn't downloaded any messages from either of my ISPs since yesterday afternoon. (I read most of my mail on my main ISP's UNIX shell, only downloading some messages to my Mac. So I'd been reading my mail fine and hadn't noticed that it wasn't gettin...

Interesting Insight to Apple's Margins on the G5s??? (take 2)
So the Apple store has the old & busted G5s on clearance now: $1999 -> $1699 (16% off) $2499 -> $1899 (25% off) $2999 -> $2699 (11% off) looks like their margins were different on these models, and the discounts disclose information on that... Not sure what it means tho. I guess the dual 2.0 was the most profitable, and the dual 2.5 was the least. I've been saying Apple needed to lower their prices $500 across the board on these models, and I guess now they have, more or less. In news:1114655810.008296.175370@o13g2000cwo.googlegroups.com, imouttahere@mac.com <imouttah...

laplace function #2
Dear MLB users, I want to use the Laplace function from the Symbolic Math Toolbox. I am wondering why it is not possible to transform a constant value e.g. 2, while 2+t^5 is no problem. What is going wrong? >> syms a s t w x >> laplace(2) ??? No appropriate methods for function laplace. >> laplace(2+t^5) ans = 2/s+120/s^6 regards, Bart "Bart Roodenburg" <b.roodenburg@tudelft.nl> wrote in message news:35a2$45a4ef83$82a1325b$28147@news1.tudelft.nl... > Dear MLB users, > > I want to use the Laplace function from the Symbolic Math Toolbox. I...

JDBC, DB/2, Apache and TomCat #2
I'm attempting to access DB/2 via V8 JDBC drivers on a Windows based Apache/TomCat web server in jsp pages. The driver loads just fine, Class.forName("com.ibm.db2.jcc.DB2Driver"), but when I try to make a connection it complains with the following error: "Failure in loading T2 native library db2jcct2" db2jcct2 is a dll file. I've been unable to find any information on this. Anyone have an idea how to get this working? Thanks Frank Frank wrote: > I'm attempting to access DB/2 via V8 JDBC drivers on a Windows based > Apache/TomC...

guild wars money #2
Where can you find so many kind of virtual golds for so many popular MMORPG in USA and Europe?! There are Runescape,World of Warcraft US/ EU,MapleStory,Guild Wars,Final Fantasy XI,Dofus,Anarchy Online,Ragnarok Online,RF online,Star Wars Galaxies,Scions Of Fate,Silkroad online,EverQuest II........ HOW COOL IS IT THAT We have what you have thought or known,and we will provide safe and fast things what you want in games until you visit our website : www.runescapecoin.com www.wowmoney.eu www.gwgold.com www.msmesos.eu ...

[News] Switch to OpenOffice (or "Another Zero-Day PowerPoint Exploit")
Another day, another zero-day MS exploit ,----[ Quote ] | The security flap over PowerPoint caps a bad week for Microsoft, which | saw the release of an unscheduled patch to combat a serious day zero | vulnerability in Internet Explorer (involving the handling of Vector | Markup Language files) on Tuesday. | | This isn't the first time a day zero vulnerability has been discovered | in Microsoft PowerPoint, either. In a similar incident back in July, | Chinese hackers exploited a different PowerPoint flaw in order to | infect vulnerable Windows systems with a key-logging Trojan( | dubbed ...

check box enable/disable #2
i want to enable one listbox and disable the other depending on if i check winter_gala (checkbox) here is my code. <script type="text/javascript"> function check() { if (document.forms.winter_gala.checked=true) { document.forms.winter_gala.young_friend_list.disabled=true document.forms.winter_gala.dual_young_friend_list.disabled=false } else if (document.forms.winter_gala.checked=false) { document.forms.winter_gala.young_friend_list.disabled=false document.forms.winter_gala.dual_young_friend_list.disabled=true } } </script> vncntj@hotmail.com wrote: > i want to en...

Tame/2 can't print
Loading Tame/2 now, after migrating to eCS, posts a warning message telling me that "prtgraph.dll can't be found". The DLL is actually there, along with Tame's other DLLs.which Tame/2 seems to have no difficulty in finding. There was also no difficulty in finding prtgraph.dll before the migration; why is there now? -- Stan Goodman, Qiryat Tiv'on, Israel Enjoying FUD-free Usenet at news.consultant.ca Ceteram, censeo Arafat esse delandam. To send me email, please replace the CAPITAL_LETTERS with "sig". Stan Goodman wrote: > Loading Tame/2 now, after mi...

Which matlab toolboxes are required for VHDL code generation
I wish to purchase Matlab toolboxes for FPGA (VHDL/Verilog) code generation for radar signal processing. What and all toolboxes I should purchase. Can somebody guide me. "Vinod" <vinodv@bel.co.in> wrote in message news:mdedvl$aca$1@newscl01ah.mathworks.com... > I wish to purchase Matlab toolboxes for FPGA (VHDL/Verilog) code > generation for radar signal processing. > > What and all toolboxes I should purchase. > Can somebody guide me. Take a look at this page: http://www.mathworks.com/solutions/hdl-code-generation-verification/ and/or ...

omniORB 4.0.2 and omniORBpy 2.2 released
omniORB version 4.0.2 and omniORBpy 2.2 are now available. omniORB is a robust, high performance CORBA ORB for C++. omniORBpy is a version for Python. They are freely available under the terms of the GNU LGPL. These are mainly bug fix releases. Highlights of the new releases include: - Bug fixes. - Use of standard iostreams in omniNames etc., if available. - Rudimentary Python interceptor support. - Performance improvements. The releases can be downloaded from SourceForge from this page: http://sourceforge.net/project/showfiles.php?group_id=51138 For general omniO...

using user-defined M-files in C++ (2)
To whom it may concern, I'm trying to call a user-defined MATLAB function that adds a constant to my data sent from C++ to MATLAB via MATLAB Engine. Figure(1) is the original result. Figure(2) is not the correct result after an addition of 100 to the original data. I think it is the conversion from 'int' in C++ and then obtaining results from MATLAB in 'double'. Below attached is my C++ code that stored data from 0-9, using MATLAB Engine to plot in Figure(1). Then, I compile 'prodfig.m' to DLL, also attached after the C++ code, call the function to add 100 to th...

Switch testing equipment
Hello, I'm in the process of evaluating some switch testing equipment and was wondering if anyone had experiences (good or bad) they could share with any of the finalists. Spirent TestCenter Anritsu MD1230B Ixia 400T They are all very similar on paper and the demos were all nice. Unfortunately a couple of hours isn't enough time to really kick the tires on them, so I'm hoping to get some real world feedback on their plusses and minuses. TIA, Dan ...

Stringtree 1.2 is here...
Hello, Stringtree 1.2 is here... This new version is optimized more, and it adds an overloaded method to get the number of files of a directory, and i think that my new Stringtree is of a good quality and i think it is a stable software. Description: TStringStree class implements a non-visual tree structure like that found in TreeView. TStringTree is a class for handling a tree-structured stringlist. TStringTree is very similar to directory structures , it uses the familiar terms of "directories" and "files" instead of nodes and child nodes. T...

Structural VHDL
I understand that entity defines inteface restricting the range of signals available for communication with instances of that entity. May be there is no much sense to bypass the restriction but I consider this opportunity to be used in test bench. uut: entity UART port map ( ..... ); --stimulate uart --wait until transmitter is empty wait until uut.transmitter.busy = '0'; -- go on If you are using ModelSim, you can use the signal spy package. Cheers, Jim Valentin Tihomirov wrote: > I understand that entity defines inteface restricting the range of signals > available...

Start Date or End Date #2
Hi How do I add the time stamp between Days in a MATLAB LOG FILE. For Example if this is the LOG FILE, it just gives me the time & the user name......but I am interested in the DAY or DATE.I need the start date or the end date. 23:35:32 (MLM) IN: "MATLAB" User1@id1USER1 8:53:04 (MLM) UNSUPPORTED: "MATLAB_Web_Server" (PORT_AT_HOST_PLUS ) SYSTEM@id1USER1 (License server does not support this feature (-18,327)) 8:53:47 (MLM) DENIED: "Image_Toolbox" user2@id1user2 (Licensed number of users already reached (-4,342)) 8:53:47 (MLM) DENIED: "Image_Toolbox&q...

Informix::DBD Installation on Sun Solaris 2.8 Problem #2
Hi, I have successfully installed and configured Informix:DBI and now, when I am installing Informix:DBD, I am getting the following errors: $ perl Makefile.PL Configuring IBM Informix Database Driver for Perl Version 2003.04 (2003-03-05) (aka DBD::Informix) You are using DBI version 1.43 and Perl version 5.006001 Remember to actually read the README file! Perl: perl5.006001 sun4-solaris dl_dlopen.xs System: sunos solaris 5.8 generic sun4u sparc sunw,ultra-5_10 Compiler: gcc -O -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS...

connecting to VPN hotel(client side) to home(server side) #2
i recently move to indonesia and staying in a hotel .. got free internet connection in the room im staying ..... hotspot type need to login on a redirect webpage before u can access other stuff ... having unique dyanmic lan ip 10.0.x.x ... i noticed when i use it .. it is somewhat filtered because i cant establish IRC connection using MIRC .... says connection refused i tried several servers even different network same result ... i tried online games it seems its block too .. wondering if i can run a vpn on my pc at home (server side).. so i can tunnel myself to establsh connection such as i...

MTA not talking? #2
Hi, A newbie question: A person is having problem sending his email to us. Following is what is logged: Nov 1 09:13:12 mydomain sendmail[1252]: iA1F809k001252: mail.hisserver.com [0.0.0.0] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA He says he can send to other people fine, and we seem to receive other people's emails fine. Can I configure my sendmail to initiate the dialog, or does his MTA needs to do that? My system: MacOS X 10.2.8 (Darwin 6.8), sendmail 8.12.9 Thanks... Steve ...

change a clock to pulse in vhdl
Hi all, I am getting difficult in simulating the vhdl code which is having a pulse train input signal x_in (20 ns period) which is synchronus to fpga clock of frequency 50 MHz. In my VHDL code pulse train is applicable for counting number of pulses in defined time base after that code is changes to find only high pulse (or counts in given high pulse of defined time base with change in x_in input signal of low for 50 ns and high for 1000 ns); the difificult i am facing is how to change pulse train x_in to just a high pulse or low pulse signal. Simulation is not happening when i u...

Re: [LogoForum] RE: are Logo users educators? (was: Logo-or-not?) #2 1987600
--Apple-Mail-2--1041833828 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1; format=flowed Dale! So many interesting holiday questions and their implied quests here.... =46rom my exposure and embrace of Waldorf educational philosophy, an = echo=20 of Rudolf Steiners tremendous and epic esoteric teaching which=20 underwrites this wholly artistically-based pedagogy, many of the=20 following thoughts proceed. Such thoughts, which some will regard as=20 meander, drift, stream of consciousness, or mere notion, or worse,=20 blind opinions, are, by my adm...