Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

Hackers are just a migratory lifeform with a tropism for computers.


devel / comp.lang.vhdl / A Simple VHDL Abstraction of an Efficient Clock Prescaler Using Cascading Shift Registers

SubjectAuthor
o A Simple VHDL Abstraction of an Efficient Clock Prescaler Using Cascading Shift Fereydoun Memarzanjany

1
A Simple VHDL Abstraction of an Efficient Clock Prescaler Using Cascading Shift Registers

<5ccd7c07-93d6-424d-909b-b13ebe6cf1f2n@googlegroups.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=185&group=comp.lang.vhdl#185

  copy link   Newsgroups: comp.lang.vhdl
X-Forwarded-Encrypted: i=1; AJvYcCWN8roA69pg+oKUZULBhH7SprTTfUx8rd3k0/CLJMPtDXfX5eCxVlJVEP2UEICEDK8y3HGHvxb/9awnssbQL0wtksZ7EzYHyTlVZ5c4mKhr4vMr
X-Received: by 2002:a05:620a:2982:b0:787:90a1:a0be with SMTP id r2-20020a05620a298200b0078790a1a0bemr15429qkp.5.1708580939168;
Wed, 21 Feb 2024 21:48:59 -0800 (PST)
X-Forwarded-Encrypted: i=1; AJvYcCW5U/dwPky0KfcZ1E8m2LZ/KgJ7qe19TApFpCz3aCIO/LHP+hb3KkOImvJyl1UMQqzU9Pq0TeGIpH1EEM81IOWvvo5OQG6jMUEAWC9i9PMq/w==
X-Received: by 2002:a05:6902:1101:b0:dc2:398d:a671 with SMTP id
o1-20020a056902110100b00dc2398da671mr424673ybu.10.1708580938908; Wed, 21 Feb
2024 21:48:58 -0800 (PST)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.vhdl
Date: Wed, 21 Feb 2024 21:48:58 -0800 (PST)
Injection-Info: google-groups.googlegroups.com; posting-host=174.27.7.224; posting-account=17wBxQoAAADBz649oFvY0CIp3TrHH6p0
NNTP-Posting-Host: 174.27.7.224
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <5ccd7c07-93d6-424d-909b-b13ebe6cf1f2n@googlegroups.com>
Subject: A Simple VHDL Abstraction of an Efficient Clock Prescaler Using
Cascading Shift Registers
From: farshid5383@gmail.com (Fereydoun Memarzanjany)
Injection-Date: Thu, 22 Feb 2024 05:48:59 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4296
 by: Fereydoun Memarzanja - Thu, 22 Feb 2024 05:48 UTC

https://gist.github.com/Thraetaona/ba941e293d36d0f76db6b9f3476b823c

Having just started learning FPGA Hardware Description Languages by attempting to write a simple LED blinker, I found that the overwhelming majority of the Internet's solution to slowing down a fast clock (for making the pulsing of an LED visible to the human eye) was either using vendor-specific, proprietary clock managers and PLLs or implementing some twenty-something-bit-wide counter as to count hundreds of thousands of clock cycles and generate a 1 Hz output.

Although there is a world of difference between counters in hardware-accelerated designs and those in software-emulated ones, I nonetheless viewed the number of daisy-chained components resulting from a mere counter as far-from-ideal and absurd; I began searching for a more efficient method.

I came upon a rather obscure blog post from 2015 (http://www.markharvey.info/art/srldiv_04.10.2015/srldiv_04.10.2015.html) outlining the exact same issue while also referencing Xilinx systems designer Mr. Ken Chapman's proposal: using FPGAs' shift register primitives (e.g., Xilinx's SRL32E) to alleviate that.

However, the method described therein would rely on the user to calculate the target frequency's factors between [2, 32) and painstakingly connect each and every instance of SRL32Es to one another, all in a manual manner, not to mention that the resulting pulse would have a low, one-cycle-long duty.

Thus, I wrote `srl_prescaler.vhd`, a fully automated template generator in VHDL for an efficient, register-based cascaded clock divider based solely on SRL32 primitives alongside AND gates---the advantage of this module is that it is very generic and easy-to-use:

```
prescaler : entity work.srl_prescaler
generic map (100e6, 1)
port map (clk_in_100mhz, ce_out_1hz);
```

In the above example, an input clock of 100 MHz (i.e., `100e6` & `clk_in_100mhz`) gets divided into a clock enable signal of 1 Hz (i.e., `1` & `ce_out_1hz`). Among the other improvements, a third optional parameter (i.e., the duty cycle) may also get supplied as a real number (0.00, 1.00) to the generic map.

Overall, this small project makes an otherwise-niche method more accessible by actually making use of the many language features that VHDL has to offer (e.g., pre-computing factor results using functions, automating hardware creation via for...generate clauses, latching using registers and guarded signals, etc.), serving as a simple yet practical learning point.

Visualized and Tabular Comparisons: https://gist.github.com/Thraetaona/ba941e293d36d0f76db6b9f3476b823c?permalink_comment_id=4856214#gistcomment-4856214

(Usenet is shutting down tomorrow on February 22, 2024; this should be one of the last messages.)

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor