Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - divide into sgments

 
Thread Tools Search this Thread
Old 05-18-2009, 08:20 PM   #1
Default divide into sgments


i am a newbie to VHDL.i have the following code which i need to submit in 2 days time as an assignment and i want to divide it into 4-bit segments.pls wud someone help me out?


LIBRARY ieee;
USE ieee.std_logic_1164.ALL;

ENTITY c_l_addr IS
PORT
(
x_in : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
y_in : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
carry_in : IN STD_LOGIC;
sum : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
carry_out : OUT STD_LOGIC
);
END c_l_addr;

ARCHITECTURE behavioral OF c_l_addr IS

SIGNAL h_sum : STD_LOGIC_VECTOR(7 DOWNTO 0);
SIGNAL carry_generate : STD_LOGIC_VECTOR(7 DOWNTO 0);
SIGNAL carry_propagate : STD_LOGIC_VECTOR(7 DOWNTO 0);
SIGNAL carry_in_internal : STD_LOGIC_VECTOR(7 DOWNTO 1);

BEGIN
h_sum <= x_in XOR y_in;
carry_generate <= x_in AND y_in;
carry_propagate <= x_in OR y_in;
PROCESS (carry_generate,carry_propagate,carry_in_internal)
BEGIN
carry_in_internal(1) <= carry_generate(0) OR (carry_propagate(0) AND carry_in);
inst: FOR i IN 1 TO 6 LOOP
carry_in_internal(i+1) <= carry_generate(i) OR (carry_propagate(i) AND carry_in_internal(i));
END LOOP;
carry_out <= carry_generate(7) OR (carry_propagate(7) AND carry_in_internal(7));
END PROCESS;

sum(0) <= h_sum(0) XOR carry_in;
sum(7 DOWNTO 1) <= h_sum(7 DOWNTO 1) XOR carry_in_internal(7 DOWNTO 1);
END behavioral;


markspiter1
markspiter1 is offline   Reply With Quote
Old 05-18-2009, 08:21 PM   #2
markspiter1
Junior Member
 
Join Date: May 2009
Posts: 3
Default
i mean into 2 4-bit segments lol sry


markspiter1
markspiter1 is offline   Reply With Quote
Old 05-18-2009, 08:22 PM   #3
markspiter1
Junior Member
 
Join Date: May 2009
Posts: 3
Default
lol sry ...two 4-bit segments.sry


markspiter1
markspiter1 is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
divide by n counter (with n as variable) rnpatil Hardware 0 04-27-2009 12:42 PM
synthesizable divide operation in VHDL varshini Hardware 0 12-02-2008 06:55 AM
LPG DVD-recorder 'failed to divide' item Ken DVD Video 0 11-13-2007 12:32 AM
Simple question, join and divide Dr Zero DVD Video 0 12-29-2003 09:52 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46