Home » Source Code » Spartan 3e » BinToBcd.vhd

BinToBcd.vhd ( File view )

From:Spartan 3e
  • By 2010-08-14
  • View(s):42
  • Download(s):2
  • Point(s): 2
			----------------------------------------------------------------------------------
-- Company: 
-- Engineer: 
-- 
-- Create Date:    23:30:05 02/28/2008 
-- Design Name: 
-- Module Name:    BinToBcd - Behavioral 
-- Project Name: 
-- Target Devices: 
-- Tool versions: 
-- Description: 
--
-- Dependencies: 
--
-- Revision: 
-- Revision 0.01 - File Created
-- Additional Comments: 
--
----------------------------------------------------------------------------------
-- Binary to n Digit BCD encoder; 
-- Input = n hexadecimal digits
-- Output = n BCD digits
-- Output = least significant n BCD digits of the BCD number (overflow lost)

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity BinToBcdEncoder_nDigits is
    Generic ( n : integer := 3);  -- number of BCD digits
    Port ( vecIn : in  STD_LOGIC_VECTOR (4*n-1 downto 0);
           bcdOut : out  STD_LOGIC_VECTOR (4*n-1 downto 0));
end BinToBcdEncoder_nDigits;

architecture Behavioral of BinToBcdEncoder_nDigits is

  procedure DecAdj(Ain : in std_logic_vector(4*n-1 downto 0);
                   Aout : out std_logic_vector(4*n-1 downto 0)) is 

    variable Ainternal: std_logic_vector(4*n downto 0);  

  begin
  Ainternal :=	'0' & Ain;
  
    for i in 0 to n-1 loop
      if Ainternal(4*i+3 downto 4*i)> "1
...
...
(Please download the complete source code to view)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 2

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
ActivePowerMeterRefProj.pdf53.52 kB02-27-09|19:14
04.00 B
BinToBcd.vhd1.99 kB02-29-08|00:38
MullAcc.vhd2.71 kB02-29-08|18:10
PMOD_AD1.vhd9.67 kB02-29-08|10:43
PMOD_DA2.vhd8.79 kB02-27-08|17:16
PowerMeter.vhd8.75 kB02-29-08|18:10
04.00 B
...
Sponsored links

BinToBcd.vhd (54.75 kB)

Need 2 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D