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

Reply

VHDL - Need to time outputs

 
Thread Tools Search this Thread
Old 12-01-2008, 09:34 PM   #1
Default Need to time outputs


Hey I'm supposed to be making a digital pattern generator for class, but I can't figure out how to slow down the outputs. When I use the logic analyzer it only goes gets the last output. I tried using wait statements but I can only have one per process. My book is pretty crappy and I can't seem to really find anything on the internet, can someone help me out?

Edit: forgot to mention some of the inptus, scancode_in is a command from a ps2 keyboard, with F0 saying released key and 5A signifying return. Choice is controlled by scan code in a different part of the system. Clock_48MHZ is a 48mhz clock on the board we're using. Custom input is just a custom input std_logic vector, don't really care about timing on that one.

My code
Code:
LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.STD_LOGIC_ARITH.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY PRESETS IS PORT( current_choice :IN STD_LOGIC_VECTOR(3 DOWNTO 0); custom_input :IN STD_LOGIC_VECTOR(17 DOWNTO 0); preset_output :OUT STD_LOGIC_VECTOR(17 DOWNTO 0); scancode_in :IN STD_LOGIC_VECTOR(7 DOWNTO 0); clk_48mhz :IN STD_LOGIC); END PRESETS; ARCHITECTURE a OF PRESETS IS SIGNAL SCANLAST :STD_LOGIC_VECTOR(7 DOWNTO 0); SIGNAL preset_last :STD_LOGIC_VECTOR(17 DOWNTO 0); BEGIN PROCESS(scancode_in, current_choice, clk_48mhz) BEGIN IF ((scancode_in = x"5A") AND (SCANLAST = x"F0")) THEN CASE current_choice(3 DOWNTO 0) IS WHEN "0000" => -- Count up preset_last(17 downto 0) <= "000000000000000000"; preset_output <= preset_last; WHEN "0001" => -- count down preset_last(17 downto 0) <= "111111111111111111"; preset_output <= preset_last; WHEN "0010" => --BIT SHIFT L to R preset_last(17 downto 0) <= "000000000000000000"; preset_output <= preset_last; preset_last(17 downto 0) <= "100000000000000000"; preset_output <= preset_last; for i in 0 to 16 loop preset_output(17-i downto 16-i) <= "01"; end loop; WHEN "0011" => -- bit shift R to L preset_output(17 downto 0) <= "000000000000000000"; preset_output(17 downto 0) <= "000000000000000001"; preset_output(17 downto 0) <= "000000000000000010"; preset_output(17 downto 0) <= "000000000000000100"; preset_output(17 downto 0) <= "000000000000001000"; preset_output(17 downto 0) <= "000000000000010000"; preset_output(17 downto 0) <= "000000000000100000"; preset_output(17 downto 0) <= "000000000001000000"; preset_output(17 downto 0) <= "000000000010000000"; preset_output(17 downto 0) <= "000000000100000000"; preset_output(17 downto 0) <= "000000001000000000"; preset_output(17 downto 0) <= "000000010000000000"; preset_output(17 downto 0) <= "000000100000000000"; preset_output(17 downto 0) <= "000001000000000000"; preset_output(17 downto 0) <= "000010000000000000"; preset_output(17 downto 0) <= "000100000000000000"; preset_output(17 downto 0) <= "001000000000000000"; preset_output(17 downto 0) <= "010000000000000000"; preset_output(17 downto 0) <= "100000000000000000"; WHEN "0100" => -- all bits on from L to R preset_output <= "000000000000000000"; preset_output <= "100000000000000000"; preset_output <= "110000000000000000"; preset_output <= "111000000000000000"; preset_output <= "111100000000000000"; preset_output <= "111110000000000000"; preset_output <= "111111000000000000"; preset_output <= "111111100000000000"; preset_output <= "111111110000000000"; preset_output <= "111111111000000000"; preset_output <= "111111111100000000"; preset_output <= "111111111110000000"; preset_output <= "111111111111000000"; preset_output <= "111111111111100000"; preset_output <= "111111111111110000"; preset_output <= "111111111111111000"; preset_output <= "111111111111111100"; preset_output <= "111111111111111110"; preset_output <= "111111111111111111"; WHEN "0110" => --OR all bits off from L to R preset_output <= NOT "000000000000000000"; preset_output <= NOT "110000000000000000"; preset_output <= NOT "111000000000000000"; preset_output <= NOT "111100000000000000"; preset_output <= NOT "111110000000000000"; preset_output <= NOT "111111000000000000"; preset_output <= NOT "111111100000000000"; preset_output <= NOT "111111110000000000"; preset_output <= NOT "111111111000000000"; preset_output <= NOT "111111111100000000"; preset_output <= NOT "111111111110000000"; preset_output <= NOT "111111111111000000"; preset_output <= NOT "111111111111100000"; preset_output <= NOT "111111111111110000"; preset_output <= NOT "111111111111111000"; preset_output <= NOT "111111111111111100"; preset_output <= NOT "111111111111111110"; preset_output <= NOT "111111111111111111"; WHEN "0101" => -- all bits on from R to L preset_output <= "000000000000000001"; preset_output <= "000000000000000011"; preset_output <= "000000000000000111"; preset_output <= "000000000000001111"; preset_output <= "000000000000011111"; preset_output <= "000000000000111111"; preset_output <= "000000000001111111"; preset_output <= "000000000011111111"; preset_output <= "000000000111111111"; preset_output <= "000000001111111111"; preset_output <= "000000011111111111"; preset_output <= "000000111111111111"; preset_output <= "000001111111111111"; preset_output <= "000011111111111111"; preset_output <= "000111111111111111"; preset_output <= "001111111111111111"; preset_output <= "011111111111111111"; preset_output <= "111111111111111111"; WHEN "0111" => -- all bits off from R to L preset_output <= NOT "000000000000000001"; preset_output <= NOT "000000000000000011"; preset_output <= NOT "000000000000000111"; preset_output <= NOT "000000000000001111"; preset_output <= NOT "000000000000011111"; preset_output <= NOT "000000000000111111"; preset_output <= NOT "000000000001111111"; preset_output <= NOT "000000000011111111"; preset_output <= NOT "000000000111111111"; preset_output <= NOT "000000001111111111"; preset_output <= NOT "000000011111111111"; preset_output <= NOT "000000111111111111"; preset_output <= NOT "000001111111111111"; preset_output <= NOT "000011111111111111"; preset_output <= NOT "000111111111111111"; preset_output <= NOT "001111111111111111"; preset_output <= NOT "011111111111111111"; preset_output <= NOT "111111111111111111"; WHEN ("1000" OR "1001")=> -- Zeros with collapsing ones preset_last <= "000000000000000000"; IF current_choice="1001" THEN preset_output <= preset_last(17 downto 0); --for collapsing ones ELSE preset_output <= NOT preset_last; -- for collapsing zeros end if; preset_last <= "100000000000000001"; IF current_choice="1001" THEN preset_output <= preset_last(17 downto 0); --for collapsing ones ELSE preset_output <= NOT preset_last; -- for collapsing zeros end if; preset_last <= "110000000000000011"; IF current_choice="1001" THEN preset_output <= preset_last(17 downto 0); --for collapsing ones ELSE preset_output <= NOT preset_last; -- for collapsing zeros end if; preset_last <= "111000000000000111"; IF current_choice="1001" THEN preset_output <= preset_last(17 downto 0); --for collapsing ones ELSE preset_output <= NOT preset_last; -- for collapsing zeros end if; preset_last <= "111100000000001111"; IF current_choice="1001" THEN preset_output <= preset_last(17 downto 0); --for collapsing ones ELSE preset_output <= NOT preset_last; -- for collapsing zeros end if; preset_last <= "111110000000011111"; IF current_choice="1001" THEN preset_output <= preset_last(17 downto 0); --for collapsing ones ELSE preset_output <= NOT preset_last; -- for collapsing zeros end if; preset_last <= "111111000000111111"; IF current_choice="1001" THEN preset_output <= preset_last(17 downto 0); --for collapsing ones ELSE preset_output <= NOT preset_last; -- for collapsing zeros end if; preset_last <= "111111100001111111"; IF current_choice="1001" THEN preset_output <= preset_last(17 downto 0); --for collapsing ones ELSE preset_output <= NOT preset_last; -- for collapsing zeros end if; preset_last <= "111111110011111111"; IF current_choice="1001" THEN preset_output <= preset_last(17 downto 0); --for collapsing ones ELSE preset_output <= NOT preset_last; -- for collapsing zeros end if; preset_last <= "111111111111111111"; IF current_choice="1001" THEN preset_output <= preset_last(17 downto 0); --for collapsing ones ELSE preset_output <= NOT preset_last; -- for collapsing zeros end if; WHEN OTHERS => -- do nothing end case; end if; IF current_choice = "1010" THEN preset_output(17 downto 0) <= custom_input(17 downto 0); END IF; SCANLAST <= SCANCODE_IN; END PROCESS; END a;


RRamsey118

Last edited by RRamsey118 : 12-01-2008 at 09:47 PM.
RRamsey118 is offline   Reply With Quote
Old 12-01-2008, 09:54 PM   #2
jeppe
Senior Member
 
Join Date: Mar 2008
Location: Denmark
Posts: 245
Default
Well you must realize - when a signal assigned inside a process will it always be the last assignment that "wins". All the previous "forgotten".

Please search for the intactive book at VHDL - Evita to learn more - speciallly chapter 6.

My surgestion will be:

1) Put wait for xx ns (but Im not sure this will work together with the sensitivitylist)
2) put after xx ns statements like xx<"00" after 1 ns (same problem as above)
3) make a more complex statemachine driven by the 48 MHz clock (complicated

Hope this made sense
Jeppe


jeppe
jeppe is offline   Reply With Quote
Old 12-01-2008, 10:16 PM   #3
RRamsey118
Junior Member
 
Join Date: Dec 2008
Posts: 2
Default
I tried using "wait for XX ns;" and the thing yelled at me saying I needed "until" which seems wrong to me. Either way I don't think it'll let me have multiple wait statements will it?

Either way, I guess I'll start working on a different design then. Thanks.
(unless someone has a magic fix, which would be awesome)


RRamsey118
RRamsey118 is offline   Reply With Quote
Old 12-02-2008, 07:50 AM   #4
jeppe
Senior Member
 
Join Date: Mar 2008
Location: Denmark
Posts: 245
Default
Well indeed: The only way your allowed to generate this kind waveform will be some kind of state machine, counter or shiftregister which controlled by the 48MHz clock.
I forgot to mention - The wait for statement not for synthesizing.
Jeppe


jeppe
jeppe 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
Help!! all dvd work except one linux4me2u@yahoo.ca DVD Video 3 02-21-2004 10:10 AM
SONY DVP-NS930: 5.1 output Kazamaza DVD Video 3 02-16-2004 02:11 PM
Can someone explain what all the outputs are for moosecall@mindsprung.com DVD Video 4 01-20-2004 08:47 PM




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