- Declaring a clock domain:
self.clock_domains.cd_mycd = ClockDomain()
- Referencing a clock domain:
self.sync.mycd += []ClockSignal("mycd")
- Requesting an I/O signal:
platform.request("clk12")
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| import serial | |
| import matplotlib.pyplot as plt | |
| script = """ | |
| # hashes make comments | |
| # @ on a read specifies the parser for the read data | |
| *RST | |
| :SENS:FUNC:CONC OFF #Turn off concurrent functions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Plot logtime in realtime using bokeh and tail -f | |
| # Tested with python 3.5 and bokeh 0.12.4 | |
| # OSX/Linux only | |
| # usage: | |
| # 1. run 'bokeh serve' | |
| # 2. run 'python3.5 main.py logfile.csv' | |
| # assumes a logfile.csv with format: | |
| # min_ask,1489758134.150000,1077.00,1076.78,0.45 | |
| # max_bid,1489758139.660000,1076.56,1076.76,0.41 | |
| # min_ask,1489758142.076000,1076.95,1076.76,0.40 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python3 | |
| """ | |
| gtkwave-sigrok-filter.py | |
| Use as a 'Transaction Filter Process' in gtkwave to apply signal | |
| Usage: | |
| - Group input signals in gtkwave with F4 | |
| - Apply this script as a 'Transaction Filter Process' (Right click / Data Format) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/ | |
| # generate server.pem with the following command: | |
| # openssl req -new -x509 -keyout key.pem -out server.pem -days 365 -nodes | |
| # run as follows: | |
| # python simple-https-server.py | |
| # then in your browser, visit: | |
| # https://localhost:4443 | |
| import http.server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def shimazaki_shinimoto_binning(x, min_bins, max_bins): | |
| """The Shimazaki-Shinimoto histogram binning algorithm for choosing an | |
| optimal constant number of bins. | |
| Parameters | |
| ---------- | |
| x : array of int or float | |
| The data you want to bin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Produces a sawtooth on A0 and samples A1 and A3 into buffers via DMA | |
| #include <Adafruit_ZeroDMA.h> | |
| #include <wiring_private.h> // for access to pinPeripheral | |
| // Create buffers for DMAing data around -- the .dmabuffers section is supposed to | |
| // optimize the memory location for the DMA controller | |
| __attribute__ ((section(".dmabuffers"), used)) static uint16_t dac_buffer[4096], adc_buffer[2][4096]; | |
| void setup() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is an nmigen delay line for ECP5 FPGAs using the open source toolchain. It strings together a series of | |
| # manually placed carry chains into a "thermometer." It returns a signal that's (length) long that represents | |
| # the chain "snapshotted" at the primary clock domain (using the flip flops colocated in the slice). | |
| # | |
| # This can be used in a Time to Digital Converter (i.e. to measure the time between to events) or in | |
| # an ADC by comparing (with LVDS) a signal to a reference signal. | |
| # | |
| # Note that the bit precision (read: delay per carry element) varies as a function of temperature. On | |
| # a LFE5U-25F-8MG285C, I've measure delay times of approximately 43ps on average. Due to assorted reasons, | |
| # the delay time will vary between bits and due to variations in routing (even when manually places), you might |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # This file is part of LiteX. | |
| # | |
| # Copyright (c) 2015-2019 Florent Kermarrec <[email protected]> | |
| # Copyright (c) 2017 Pierre-Olivier Vauboin <po@lambdaconcept> | |
| # Copyright (c) 2021 Jevin Sweval <[email protected]> | |
| # SPDX-License-Identifier: BSD-2-Clause | |
| from pathlib import Path | |
| import os |
These commands come AS IS, WITH NO WARRANTY. I AM NOT RESPONSIBLE IF YOU BORK YOUR SYSTEM
Synergy on Linux - It's great when it works, but it's also a pain because most guides are intended for Ubuntu 18, which is absolutely useless now. Here is how I was able to setup Synergy at login on a Pop_OS 22.04, but should ALSO work for ANY distribution using GDM3 as it's login manager (i.e Fedora and/or Ubuntu).
Install synergy. Make sure that synergyc is installed first (included in deb or rpm)
OlderNewer