Skip to content

Instantly share code, notes, and snippets.

@sgherbst
sgherbst / serde_yaml_return_mapping.rs
Created April 28, 2021 21:47
Returning a serde_yaml Mapping for building a nested Mapping
// adapted from serde_json example: https://stackoverflow.com/a/39147207
extern crate serde_yaml;
use serde_yaml::{Value, Mapping, Number};
fn main() {
let mut map = Mapping::new();
build_mapping(&mut map, 1);
println!("{}", serde_yaml::to_string(&map).unwrap());
// ---
@sgherbst
sgherbst / serde_yaml_mapping_modify.rs
Last active April 28, 2021 20:04
Modifying a serde_yaml Mapping in a function
// adapted from serde_json example: https://stackoverflow.com/a/39147207
extern crate serde_yaml;
use serde_yaml::{Value, Mapping, Number};
fn main() {
let mut map = Mapping::new();
build_mapping(&mut map, 1);
println!("{}", serde_yaml::to_string(&map).unwrap());
// ---
@sgherbst
sgherbst / serde_yaml_mapping.rs
Created April 28, 2021 19:51
Building a serde_yaml Mapping
// adapted from serde_json example: https://stackoverflow.com/a/39147207
extern crate serde_yaml;
use serde_yaml::{Value, Mapping, Number};
fn main() {
let mut inner_map = Mapping::new();
inner_map.insert(Value::String("x".to_string()), Value::Number(Number::from(10u64)));
inner_map.insert(Value::String("y".to_string()), Value::Number(Number::from(20u64)));
@sgherbst
sgherbst / top.sv
Created October 3, 2020 02:15
top.sv generate example
// top.sv
module my_module (
input i_clk,
output o_clk
);
endmodule
module top (
input logic i_clk,
output logic [1:0] o_clks
@sgherbst
sgherbst / slang_test.json
Created October 3, 2020 02:12
slang output
{
"name": "$root",
"kind": "Root",
"addr": 140418817750560,
"members": [
{
"name": "",
"kind": "CompilationUnit",
"addr": 140418822058456
},
@sgherbst
sgherbst / install_vivado_2020_1.md
Last active September 6, 2020 17:23
Installing Vivado 2020.1 on Ubuntu 18.04.2 LTS for the ZCU106 Board
@sgherbst
sgherbst / synplify_dw.md
Created May 25, 2020 18:33
Running Synplify with DesignWare components
  1. Launch Synplify Premier:
> module load base synplify
> synplify_premier
  1. Import RTL and constraints with FileBuild Project
  2. Open compile options with OptionsConfigure Verilog Compiler
  3. Check box for Use DesignWare Foundation Library
  4. Set the Design Compiler Install Location. This should be the Synopsys folder that has subfolders dw, doc, libraries, etc.
  5. Compile with RunRun
@sgherbst
sgherbst / pll.sv
Created January 30, 2020 13:30
SystemVerilog PLL Simulation
// run simulation with xrun pll.sv +access+rw
// view results with simvision
`timescale 1s / 1fs
module ringosc (
input real vdd,
output logic out
);
// YOUR CODE HERE
(NMOS_THKOX
(NCSU_Devices_FreePDK45 NMOS_THKOX symbol)
(
(d D)
(g G)
(s S)
(b B)
)
)
(NMOS_VTG
@sgherbst
sgherbst / install.md
Last active October 14, 2023 08:47
Installing Vivado 2018.3 on Ubuntu 18.04 for the PYNQ-Z1 board