Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Programmed DE0 doesn't work

Status
Not open for further replies.

mahmood.n

Member level 5
Joined
Dec 2, 2011
Messages
85
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
2,046
We have a DE0 board and the manual is quite straight forward. Consider this simple counter code

Code:
library ieee;
use ieee.std_logic_1164.all;

entity counter2 is
	port( clk, rst: in std_logic;
		  q: out integer range 0 to 31);
end;

architecture x of counter2 is
begin
	process( clk, rst )
		variable tmp: integer := 0;
	begin
		if ( rst = '1' ) then
			tmp := 0;
		elsif (clk'event and clk = '1') then
			tmp := tmp + 1;
			if ( tmp = 32 ) then
				tmp := 0;
			end if;
		end if;
		q <= tmp;
	end process;
end;

According to the manual, the push button pins are described in page 27 fig 4-5
F1 -> CLK
G3 -> RST

And the LEDs are described in page 28, fig 4-8 (J1, J2, J3, H1, F2). I configured the chip with these pins. As you can see in the attached picture, the programming phase is done successfully and I see that board initial works (flashing leds) are stopped for programming. However, as I press the buttons, the LEDs don't work. If you look at the attached board picture, the five bits (output q) are turned off which shows the board is configured.

Any idea to debug more?
 

Attachments

  • pins.jpg
    pins.jpg
    452.5 KB · Views: 49
  • 20170504_144459_001.jpg
    20170504_144459_001.jpg
    89 KB · Views: 49

I guess you didn't realize the Button operation is inverted, signal goes to '0' when pressed. Respectively your design is hold in reset permanently unless you hold Button1 down.
 
There are somethings to consider.
1> What is your clock frequency and how are you supplying the clock? If the freq is too high, the blinking of LEDs might be too fast for the human eye to register.
2> Avoid using variables. Use signals (you can do almost everything with signals). The code would be better off as

Code:
		if ( rst = '1' ) then
			tmp := 0;
		elsif (rising_edge'clk) then			
			if ( tmp = 32 ) then
				tmp := 0;
                        else 
                                tmp := tmp + 1;
			end if;
		end if;
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top