Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wanted solution for this problem

Status
Not open for further replies.

RVSachin

Technical User
Nov 12, 2001
77
IN
Hi everyone,

If data_in 'n'bits wide and data_out = k*n wide where k is a positive integer then if for a particular case data_in = 4 bits and k = 4,and data_in is changing arbitarily as A, B, C, D, I want data_out as "A000", "AB00" "ABC0", ABCD" at each rising edge of clock.
i.e, at every k th + ve edge of clk, the data is combined into one single word of data_out width.

This should be valid for parameterised data_in width and any value of k.

Can some one please help in this regard.

 
I dont have time to write the code but i can give a qualitative answer. See if that helps.

You need a counter which counts from 0 to 3 and goes back to 0.

When counter is 0 => load data_in into first slot (of n bits) and zero out the rest of the 4 slots. You will get "A000"

when counter is 1 => load data_in into second slot but feedback old data into first slot

and so on when counter is 2 and 3.

the main logic will look something like this

case count is
when 0 =>
data_out (15 downto 12) <= data_in;
data_out (12 downto 8) <= &quot;0000&quot;;
data_out (7 downto 4) <= &quot;0000&quot;;
data_out (3 downto 0) <= &quot;0000&quot;;

when 1 =>
data_out (15 downto 12) <= data_out(15 downto 12);
data_out (12 downto 8) <= data_in;
data_out (7 downto 4) <= &quot;0000&quot;;
data_out (3 downto 0) <= &quot;0000&quot;;

when 2 =>
data_out (15 downto 12) <= data_out(15 downto 12);
data_out (12 downto 8) <= data_out (12 downto 8);
data_out (7 downto 4) <= data_in;
data_out (3 downto 0) <= &quot;0000&quot;;

similarly whe count is 3
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top