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

Reply

VHDL - generic maps based on an input signal

 
Thread Tools Search this Thread
Old 05-27-2008, 10:32 AM   #1
Default generic maps based on an input signal


Hi all,

I am trying to build a block whose component ports' length depend on an input. However I have problems which I honestly cannot solve.

myBlock will accept an input 'count'. This will then be converted to an integer. From that integer, the 256-bit input will be sliced. So the length of bits that will enter subBlock will only be the input bits running from that
integer downto 0. While the length of subOut will be half the length of subIn.


Below is the code:


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

entity myBlock is
generic (x : natural :=16;
y : natural := 32;
z : natural := 5);
port (clk, rst : in std_logic;
count : in std_logic_vector (z-1 downto 0);--THIS WILL BE CONVERTED TO INTEGER
input : in std_logic_vector (y-1 downto 0);
output : out std_logic_vector (x-1 downto 0));
end myBlock;

architecture bhv of myBlock is

component subBlock
generic (a : positive;
b : positive);
port (clk, rst : in std_logic;
subIn : in std_logic_vector (a-1 downto 0);
subOut : out std_logic_vector (b-1 downto 0));
end component;

signal q, q2 : integer;
begin

q <= conv_integer (count);
q2 <= q/2;

subBlock generic map (a=>q2, b=>q)
port map (clk, rst, input, output)

end bhv;



Such code above gave me the following errors:
The actual value (Signal 'q2') associated with a generic must be a globally static expression.
The actual value (Signal 'q') associated with a generic must be a globally static expression.
Try as I might I really don't know how to make q and q2 global statics. What do I do now?

Many thanks,
tahder


tahder
tahder is offline   Reply With Quote
Old 05-27-2008, 11:03 AM   #2
tahder
Junior Member
 
Join Date: Mar 2008
Posts: 6
Default
I'm sorry I had already posted my question above when I read this thread
http://www.velocityreviews.com/forum...-changing.html

However, the block I am trying to implement has several subblocks so I do component instantiation because I felt it is manageable and good for reuse. There is no process in my architecture body.

Thanks again,
tahder


tahder
tahder 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
Wonderful data input with web reporting tool freezea Software 0 09-09-2009 05:30 AM
I am having trouble editing a signal in a sub program. Haai Hardware 0 08-28-2007 02:58 PM
IMHO, Digital SECAM video is better than Analog NTSC video Radium DVD Video 167 10-25-2006 04:16 AM
DVD Recorder-DV input & Hard Drive ? Marion DVD Video 7 05-16-2004 06:31 PM
Convert S-video to RF signal Monkey Monkey DVD Video 10 01-14-2004 08:17 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