We can update you automatically when this page changes.
To receive regular notification of updates to our Model of the
Month section, click here.
This months Tip of the Month looked at the use of the others expression in expressing magic numbers. This months Model of the Month shows how the others expression can be used in modeling a common hardware function, namely a demultiplexer.
The demux_32 code relies on the use of a conversion function in order to minimize the amount of VHDL code that needs to be written; to_integer is defined in the generic_conversions package and compiled into the vfp library.
Notice also that the y output is initialized to all '0' at the start of the process, so even though there is no else branch for the if statement, incomplete assignment does not apply (and therefore you will not get latches from synthesizing this code). Speaking of synthesis, you will need to change the code to use the correct conversion function for your synthesis tool to_integer is for simulation only.
You are welcome to use the source code we provide but you must keep the copyright notice with the code (see the Acknowledgements page for more details).
-- demux_32 -- -- +-----------------------------+ -- | Copyright 1997 DOULOS | -- | Library: multiplexer | -- | designer : Tim Pagden | -- | opened: 31 Oct 1997 | -- +-----------------------------+ -- Architectures: -- 31.10.97 behaviour library ieee; library vfp; -- behaviour architecture behaviour of demux_32 is use ieee.std_logic_1164.all; use vfp.generic_conversions.all; begin demux_a_to_y: process (a, enable) begin y <= (others => '0'); if enable = '1' then y(to_integer(a)) <= '1'; end if; end process; end behaviour;
FPGA
/ ASIC Design and Project Services
Doulos Training Courses
Copyright 1995-1997 Doulos
This page was last updated 31th October 1997
We welcome your e-mail comments. Please contact us at: webmaster@doulos.co.uk