Electronics development

Moderators: None (Apply to moderate this forum)
Number of threads: 512
Number of posts: 1020

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Problem in understanding a keyword !! Posted by apanimesh061 on 3 Mar 2011 at 6:51 AM
I am new to VHDL !
I was trying ALU in VHDL ...
I could design Logic Unit but not Arithemetic unit. So, I checked out on the internet and found this code. But I am not able to understand the architecture part !!! PLEASE HELP !
Thnx !

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
 
entity AU_4bit is
Port( a, b :  in std_logic_vector(3 downto 0);			-- inputs
		     s :  in std_logic;				-- select
		     g : out std_logic_vector(3 downto 0); 		-- output
		  Cout : out std_logic := '0');
end AU_4bit;
 
architecture Behavioral of AU_4bit is
signal sum, prod: std_logic_vector(3 downto 0);    	-- product and sum
begin

sum <= conv_std_logic_vector(UNSIGNED(a) + UNSIGNED(b), 4);
prod <= conv_std_logic_vector(UNSIGNED(a(1 downto 0))*UNSIGNED(b(1 downto 0)), 4);
g <= sum 
  when (s='0') 
    else prod;
Cout <= '1' 
  when (((conv_integer(a) + conv_integer(b)) > 15) and s='0') 
    else '0';
 
end Behavioral;




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.