Electronics development

Moderators: None (Apply to moderate this forum)
Number of threads: 541
Number of posts: 1056

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

Report
Component Instantiations in VHDL Posted by frufru121 on 10 Nov 2012 at 5:08 PM
Hi All,

I am relatively new to VHDL and I'm trying to implement the following actions for the various ctrl strings stated:

--ADD when ctrl="000" else
--SUB when ctrl="001" else
ALUOUT <= ABUS and BBUS when ctrl="010" else
ALUOUT <= ABUS or BBUS when ctrl="011" else
ALUOUT <= ABUS xor BBUS when ctrl="100" else
ALUOUT <= not ABUS when ctrl="101" else
ALUOUT <= ABUS when ctrl="110"

My problem is that I already have an adder designed in a verilog module which I am calling using component instantiation and the principle
"A-B=A+(not B) + 1"
for the Subtraction operation.

The two component instantiations are as below:
u1: NBitAdder port map(Aalu=>ABUS, Balu=>BBUS, c=>'0', sumA=>ALUOUT, carryA=>cout);
u2: NBitAdder port map(Aalu=>ABUS, Balu=>not BBUS, c=>'0', sumA=>ALUOUT, carryA=>cout);

But how can I implement only 1 of these depending on the ctrl inputs?? As, from what I understand an instantiation cannot be used within the WHEN process.

Any help would be much appreciated.

Thanks in advance.



 

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.