Frequency divider works only for some divisors (Verilog on Lattice iCEstick FPGA)

I'm trying to build a frequency divider on a Lattice iCEstick using Verilog (with yosys, arachne-pnr, and icepack/iceprog):

 module demo(input clk, output LED1, LED2, LED3, LED4, LED5);     assign LED1 = state;     // Generate impulse at lower frequency:                                                                                                                              wire out_clk;    reg [31:0] cnt;    initial cnt <= 0;    always @(posedge clk) cnt <= cnt >= 6000000 ? 0 : cnt + 1;    assign out_clk = cnt == 0;     // On impulse, toggle state:                                                                                                                                         reg state;    initial state <= 0;    always @(posedge out_clk) state <= ~state;  endmodule 

This works as expected, i.e. the LED on the board blinks about once a second (the clock is 12MHz).

However, when 6000000 is replaced with 5000000 the LED simply stays on permanently. Why is that?

Simulating with Icarus shows the expected state changes, no matter what the divisor is.

Replay

Category: fpga Time: 2016-07-30 Views: 0
Tags: fpga verilog

Related post

  • Search works only for some users 2013-06-20

    Configured search on SharePoint Foundation 2010, but only some user can get the search results, the others not! Users have different privileges, so it's not the case when search works only with farm admins. --------------Solutions------------- Inspec

  • How to disable internet connection only for some standard user accounts in Windows 7 Ultimate? 2012-01-18

    There are many users in my machine with Windows 7 Ultimate installed. Some of them are standard user accounts that have no administrative access to the computer. I want them to be unable to connect to the internet because of security issues. How to d

  • SelectList onchange not firing only for some values 2015-10-07

    Having a simple apex:selectList and using apex:actionSupport to handle user selections which is working fine. Surprised that the event is not firing only for some values. page: <apex:actionRegion id="salesItemActionRegion"> <apex:output

  • iptables REDIRECT works only for first packet 2015-12-06

    i need to redirect all UDP packets with destination port 15000 to port 15001 if the packet contains for example the string test. i have these two simple rules: iptables -t nat -A PREROUTING -i eth0 -p udp --dport 15000 -m string --string 'test' --alg

  • Is there any way to get Azure status update only for some services and regions I am using? 2016-02-09

    Is there any way to get Azure status update only for some services and regions I am using? For example, I am using Cloud Services in West US. When this service in West US is down, I want to get an alert for it. I don't care about other services and o

  • .tex alignment works only for the main 2014-07-07

    The text alignment (using the tab in emacs) works only for the main tex document but not for the included tex files. Is there any option for that? it is not really a problem but the appearance helps for the writing

  • Notepad++ auto trim trailing spaces on save only for some file extensiones 2015-04-30

    I'm using a Notepad++ macro to 'Trim trailing and save' files. And I have setup to [Ctrl]+[S] hotkey. But, sometimes I'm editing files that I need to keep their spaces. Is it possible to set up a macro only for some file extensions? Or there is anoth

  • Slow Internet on Lion, but only for some sites and some browsers 2011-08-21

    I've upgraded to Lion today and since then I am facing a very strange problem. Gmail, Facebook, discussions.apple.com do not load at all, and IF they loaded, I get only text with no CSS or images. support.apple.com, Google, apple.stackexchange.com wo

  • Configuring location based GPO for WSUS updates but only for some clients 2012-01-20

    I would like to configure WSUS so that employees arrive in main location they use WSUS to download stuff, and when they are in other locations (different locations / home etc) they use Windows Updates. It was suggested in this question to use subnets

  • "The SELECT permission was denied" only for some of my tables 2013-02-22

    In my database there are about 100 tables on 2 tables I get the following error when accessing the database by a SP (all data access uses SP): The SELECT permission was denied on the object 'XXX' database 'XXX' schema 'dbo'. sql server 2008 I can fix

  • SPListItem item["Author"] throws ArgumentException on blog lists only for some users 2012-09-13

    We have a webpart on our SiteCollection home page which aggregates the most recent posts from a number of blog subsites. The code looks like this: using (SPSite site = new SPSite(GetBlogSiteCollectionUrl())) { foreach (SPWeb currentWeb in site.OpenWe

  • autocomplete search works only for admin role 2013-02-25

    I am using apachesolr search module for my drupal 6 website. On the configuration page of apachesolr I enabled autocompelete for search box. Now there are two options : use apache solr autocompelete widget : use Drupal core autocompelete widget First

  • Internet connection working properly for some computers, but not others 2013-03-22

    I hope this is the right place to ask this question. If it isn't, please let me know where it would be appropriate, as this problem has been plaguing me for some time. At any rate, my problem is this: I have two laptops, both running Windows 7 Home P

  • Workflow that triggers the same workflow for the next item - works only for 10 first items 2014-01-23

    I have this scenario where I need to loop through a list of items. As workflows don't offer a looping functionality, I created a following workflow: 1. It fires when an item is changed. 2. It does its job, changes Processed field value on current ite

  • required field only for some users 2014-01-28

    I have a required field that only needs to be required for some users. (not all) At this time, I have written a validation rule that will only do the validation for the users that I want. The problem however is that when users are creating / editing

  • Why scaling of arrow head works only for default and not for latex, stealth, or other types? 2015-05-28

    I am following the answer here where it shows how to adjust the arrow head. It works, but only for default > arrow head. When I change it to latex, stealth or any of the other type of arrow heads, the size does not change. MWE \documentclass[12pt]{ar

  • Random post works only for authenticated users? 2016-01-18

    My code in a file .php: <?php /** * Template Name: Random Post * * This is the template for random posts * * @package activello */ get_header(); ?> <h1 class="page-title">Random</h1> <p>post random? yes, exclusive, limite

  • domain-shared-contacts API : gd:extendedProperty works only for max 10 properties 2016-02-11

    Following Google domain-shared-contacts APIs, I am trying to create a domain shared contact using Go Programming Language. gd:extendedProperty works fine only for 10 extended properties. If I want to add more, I get error as : 400 Bad Request Complet

  • Biblatex: first names in text only for some sources - why? 2016-07-28

    I have a rather complex document using the biblatex style apa. For some sources that I cite first names appear (which I don't want, according to the APA guidelines), such as in: \autocite{windttheoryconsciousness} which yields (Jennifer M. Windt & No

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 2.999 (s). 13 q(s)