- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am new user try to run my simple test on Altera Max V eval kit. I wrote a simple code want to verify a simple function:
http://www.alteraforum.com/forum/attachment.php?attachmentid=12665&stc=1 in file counter.vmodule counter( CLOCK_10KHZ, counter_out, RESET);
input CLOCK_10KHZ;
input RESET;
output counter_out;
reg counter_out;
always @(posedge CLOCK_10KHZ) begin
if (!RESET) begin //Reset button is not pushed
counter_out <=# 1 ~(counter_out + 1); //increment counter, neg light up the LED, and pos turn off
end
else begin
counter_out <=# 1 ~16'b0;
end
end
endmodule
When I push the reset button, the LED goes off, that proved clock trigger signal is correct, however, after I release the PB1, all LEDs still on and didn't change status(It suppose to light up and turn off while counter increasing). Platform: Windows 7,64bit, Quartus Prime Lite Edition 16.0. MAX V Eval Board Could anyone take a look what might be wrong with my program? Thank you!
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
counter_out <=# 1 ~(counter_out + 1);
This is not doing what you want it too and is just resulting in 'counter_out' holding a static value (both in and out of reset).
counter_out <= counter_out + 1;
Then, outside of that always block, deal with the inversion that the LEDs on your hardware require. assign led = ~counter_out;
Finally, swap 'led' for 'counter_out' in your module's port list. Cheers, Alex
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page