needhelp123
Newbie level 5
- Joined
- Aug 7, 2013
- Messages
- 8
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 65
In need of help, I have a program here which I need to submit next week. I just need to add in 1 cycle clock delay but I have no idea how.
This is my code
This is my code
Code VHDL - [expand] 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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 Library IEEE; use IEEE.std_logic_1164.all; use IEEE.std_logic_unsigned.all; use IEEE.std_logic_arith.all; ENTITY fpga is port( data_clk: in std_logic; data_out: out std_logic; data_in: in std_logic; osc: in std_logic; rst: in std_logic; LED: out std_logic ); END fpga; ARCHITECTURE behaviour of fpga is signal counter: integer range 0 to 7; signal data: std_logic; signal output2: std_logic_vector(7 downto 0); signal receiving: std_logic_vector(7 downto 0); begin process(osc,rst) begin if(rst = '0') then -- reset button pressed counter <= 0; -- counter will show 0 output2 <= "01000110"; -- output2 still running LED <= '1'; -- LED will not light up data_out <= '0'; elsif (rising_edge(osc)) then receiving <= receiving(6 downto 0) & data_in; --shifts the bottom seven bits of receiving left by one --puts the new data bit from the data_in to bit 0 of dat_reg if (data_in = data_out) then -- compare data_in & data_out LED <= '0'; else LED <= '1'; end if; if(counter < 7) then counter <= counter + 1; else counter <= 0; end if; case counter is -- Transmitter when 0 => data_out <= output2(0); when 1 => data_out <= output2(1); when 2 => data_out <= output2(2); when 3 => data_out <= output2(3); when 4 => data_out <= output2(4); when 5 => data_out <= output2(5); when 6 => data_out <= output2(6); when 7 => data_out <= output2(7); when others => data_out <= '0'; end case; end if; end process; end behaviour;
Last edited by a moderator: