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
ALU VHDL with shift operation Posted by BarneyStev on 14 Nov 2011 at 1:47 AM
Hey guys,
I am developing an Alu with VHDL, which consists of 3 entries and one out signal. The ALU performs 8 operations and one of them is shift. Unfortunately i am not able to write the shift operation properly. This is what my code looks like at the moment:

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity alu is

port (
a : in std_logic_vector(7 downto 0);
b : in std_logic_vector(7 downto 0);
s : in std_logic_vector(2 downto 0);
c : out std_logic_vector(7 downto 0)
);
end alu;

architecture five of alu is

signal one : std_logic_vector(7 downto 0);
signal three : std_logic_vector(7 downto 0);

begin

one <= "00000001";
three <= "00000011";

c <= "00000001" when s = "000" and (unsigned(a) > unsigned(b))else "00000000" when s = "000" and (unsigned(a) <= unsigned(b)) else
"00000001" when s = "001" and (unsigned(a) = unsigned(b)) else "00000000" when s = "001" and (unsigned(a) /= unsigned(b)) else std_logic_vector(signed(a) + signed(one)) when s = "010" else std_logic_vector(signed(a) + signed(b)) when s = "011" else
a and b when s = "100" else
a or b when s = "101" else
std_logic_vector(b sla unsigned(three)) when s = "110" else
std_logic_vector(unsigned(a) mod unsigned(b)) when s = "111" else
"--------";
end five;


Has anybody an Idea, how could i write the shift function to make it work this way and become a vector as output? I would be very very thankful!

Thanks a lot!

Barney



 

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.