From 3ca7604967b60c269e1508b7d0c4c04118b6f140 Mon Sep 17 00:00:00 2001 From: Lieuwe Leene Date: Fri, 26 Nov 2021 18:51:05 +0100 Subject: [PATCH] content update November --- content/posts/2021/configure-nginx.md | 25 ++++- content/posts/2021/domain-setup.md | 28 +++-- content/posts/2021/mermaid-uml.md | 46 ++++++++ content/posts/2021/mile-stones.md | 5 +- content/posts/2021/spice-monkey.md | 150 +++++++++++++++++++++++++- 5 files changed, 242 insertions(+), 12 deletions(-) diff --git a/content/posts/2021/configure-nginx.md b/content/posts/2021/configure-nginx.md index 8926987..1e37c51 100644 --- a/content/posts/2021/configure-nginx.md +++ b/content/posts/2021/configure-nginx.md @@ -1,11 +1,32 @@ --- -title: "Configure Nginx 🧩" +title: "Setting up a NGINX configuration 🧩" date: 2021-10-31T15:08:33+01:00 draft: false toc: false images: tags: - - untagged + - website + - config + - nginx --- This is a test + +```bash +nginx +├── conf.d +│   ├── hugo.conf +│   ├── leene.robots +│   ├── leene.ssl +│ └── ... +├── nginx.conf +├── sites-available +│   ├── lieuwe +│ └── ... +├── sites-enabled +│   ├── 0root +│   ├── lieuwe -> ../sites-available/lieuwe +│ └── ... +├── nginx.conf +└── ... +``` diff --git a/content/posts/2021/domain-setup.md b/content/posts/2021/domain-setup.md index c88209a..b32ae68 100644 --- a/content/posts/2021/domain-setup.md +++ b/content/posts/2021/domain-setup.md @@ -17,12 +17,12 @@ services require. | Name | Description | ----------------------------------------------- | ----------------------- -| **A** Address record | physical IPv4 address associated with this domain -| **CNAME** Canonical name record | Alias name for A record name. This is generally for subdomains (i.e. other.domain.xyz as alias for domain.xyz both served the same machine) -| **CAA** Certification Authority Authorization | DNS Certification Authority Authorization, constraining acceptable CAs for a host/domain. -| **DS** Delegation signer | The record used to identify the DNSSEC signing key of a delegated zone -| **MX** Mail exchange record | Maps a domain name to a list of message transfer agents for that domain -| **TXT** Text record | Carries machine-readable data, such as specified by RFC 1464, opportunistic encryption, Sender Policy Framework, DKIM, DMARC, DNS-SD, etc. +| `A` Address record | // physical IPv4 address associated with this domain +| `CNAME` Canonical name record | Alias name for A record name. This is generally for subdomains (i.e. other.domain.xyz as alias for domain.xyz both served the same machine) +| `CAA` Certification Authority Authorization | DNS Certification Authority Authorization, constraining acceptable CAs for a host/domain. +| `DS` Delegation signer | The record used to identify the DNSSEC signing key of a delegated zone +| `MX` Mail exchange record | Maps a domain name to a list of message transfer agents for that domain +| `TXT` Text record | Carries machine-readable data, such as specified by RFC 1464, opportunistic encryption, Sender Policy Framework, DKIM, DMARC, DNS-SD, etc. The essential records for web services are the A and CNAME records which enable correct name look up when outside you private network. Nowadays SSL should be @@ -52,3 +52,19 @@ which yields a long public key. You need to break this key up into multiple strings which the `openkdim` tool may or may not do by default as there is a maximum character length for each TXT entry element. As long as no semi-colons are inserted this should just work as expected. + +### Debugging DNS Issues + +Often is things don't go as expected. Especially with DNS related issues since +caching prevents real-time corrections. + +```bash +nslookup leene.dev +dig $DOMAIN_NAME $RECORD_NAME +``` + +Two of the better tools here is nslookup and dig. The first will generally +tell you how and where you name lookup is being resolved. Sometimes this +may not be as expected so its always good to double check. The second is +literally a DNS utility that lets you query specific records. For example +testing your openDKIM setup relies on the DNS record correctly being set. diff --git a/content/posts/2021/mermaid-uml.md b/content/posts/2021/mermaid-uml.md index 960f321..ecb613c 100644 --- a/content/posts/2021/mermaid-uml.md +++ b/content/posts/2021/mermaid-uml.md @@ -120,3 +120,49 @@ classDiagram PyViewer <-- ArchiveLoader PyViewer <-- ApplicationWindow ``` + +### Live viewer command line script + +The bash script below uses feh, an X11 image viewing utility, inotify-tools +and ImageMagic from the command line to provide a live view of a mmd file +that is built as changes are made to the file. + +```bash +#!/usr/bin/env bash +function usage() { + usage_str="$(basename "${BASH_SOURCE[0]}") IN_FILE OUT_FILE" + usage_str+="[ --config= | -c ] " + usage_str+="[ -h | --help ]" + cat <<<" +Usage: + $usage_str +Options: + -c | --config: Specify CSS style for Mermaid diagram + Default: None + -h | --help: Displays this menu + " + exit 1 +} +function main() { + local ARGS=("-i" "$1" "-o" "$2") + case "$1" in + -c) ARGS=("-i" "$3" "-o" "$4" "-c" "$2");; + --config=*) ARGS=("-i" "$2" "-o" "$3" "-c" "${1#*=}");; + -h|--help) usage;; + -*) echo "Invalid Option: $1"; usage ;; + esac + # echo "IN:${ARGS[1]} OUT:${ARGS[3]}" + mmdc ${ARGS[@]} &> /dev/null + mogrify -trim "${ARGS[3]}" + feh --reload 2 "${ARGS[3]}" & + sleep 0.1 + inotifywait -qm --event modify --format '%w' "${ARGS[1]}" | \ + ( mmdc ${ARGS[@]} ; mogrify -trim "${ARGS[3]}" ) &> /dev/null +} +if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then + if [ "$#" -lt 2 ] || [ "$#" -gt 4 ] ; then + usage + fi + main "$@" +fi +``` diff --git a/content/posts/2021/mile-stones.md b/content/posts/2021/mile-stones.md index 350efd0..524d98e 100644 --- a/content/posts/2021/mile-stones.md +++ b/content/posts/2021/mile-stones.md @@ -10,9 +10,8 @@ tags: This is a list of topics that I may include at some point in time: 1. SSL and NGINX setup guide 2. Postfix setup guide -3. Danbooru setup guide -4. pyside notes from pyviewer project -5. other fun stuff +3. Pyside notes from pyviewer project +4. Other fun stuff I also want to share some of the IC design work building up a technical profile: 1. Chip gallery diff --git a/content/posts/2021/spice-monkey.md b/content/posts/2021/spice-monkey.md index 577b189..8a67bc3 100644 --- a/content/posts/2021/spice-monkey.md +++ b/content/posts/2021/spice-monkey.md @@ -10,8 +10,22 @@ tags: - verification --- +Netlisting issues can be some of the more frustrating aspects of circuit design +tool chains primarily because its it all text based and very old fashioned. +The Cadence tools for example have various command-line utilities but +documentation is underwhelming to say the least. Quite often though they are +inevitable when combining different tools, design flows, or handling someone +else's IP. In order to cope with the usual inconsistencies I rely on the +scripts below to pre and post process SPICE netlists. -## Port Order Reshuffling +### Port Order Reshuffling + +The default netlister and spice simulators usually connects sub component +terminals in terms of the order in which they are defined in the spice `.SUBCKT` +definition. Conflict arises however since IP vendors on the other hand tend +to sort the port order in someway in the spice netlist but the Cadence +symbol/schematic definition will usually disregard this order causing +connectivity issues later. ```bash function getSortedOrder() { @@ -28,6 +42,19 @@ function getSortedOrder() { fi echo "${SOURCE[@]:0:2} ${SORTED[@]}" } +``` + +Cadence tools will prefer alphabetical ordering. The bash script above will +replicate this sorting behaviour if you pass it a `.SUBCKT` definition string. +The purpose here is that when you are given a netlist from a vendor you can +prepare an internal version that already sorts the ports alphabetically. + +In order to do this in terms of editing a file however you can use the script +below which is called as: `updatePortOrder $CKT_NAME $FILE_NAME`. This will +look for the definition given a `CKT_NAME` in the spice file and create a +new file `CKT_NAME.cdl` in the current directory. + +```bash function updatePortOrder() { local TARGET="$1" local CDL_FILE="$2" @@ -43,6 +70,10 @@ function updatePortOrder() { } ``` +The second script however relies on some awk-based spice parsing calls to +properly find and replace the relevant sections in the netlist. `catch.awk` +simple finds the `SUBCKT` statement relevant and prints it to stdout. + ```awk BEGIN{ hold = ""; IGNORECASE = 1 } NF { @@ -53,6 +84,9 @@ NF { $0 ~ target { hold = $0 }; ``` +Then `release.awk` helps to insert the definition back into the netlist with +the option to swap out any delimiters in the port names. + ```awk BEGIN{output="";hold="";IGNORECASE=1}; NF{if($1!="+")hold=""} @@ -67,3 +101,117 @@ $0~target{ print output} NF{if(hold=="")print $0} ``` + +### Netlisting Environment: + +```skill +;; spice.env +simStopList = '("auCdl") +simViewList = '("auCdl" "schematic") +auCdlDefNetlistProc = "ansCdlSubcktCall" +globalGndSig = "" +globalPowerSig = "" +shrinkFACTOR = 0 +checkScale = "meter" +preserveDIO = 'nil +checkDIOAREA = 'nil +checkDIOPERI = 'nil +preserveCAP = 'nil +checkCAPVAL = 'nil +checkCAPAREA = 'nil +checkCAPPERI = 'nil +preserveRES = 'nil +checkRESVAL = 'nil +checkRESSIZE ='nil +resistorModel = "" +shortRES = 2000 +simNetlistHier = 't +pinMAP = 'nil +displayPININFO = 't +checkLDD = 'nil +connects = "" +setEQUIV = "" +cdlSimViewList = '("auCdl" "schematic") +cdlSimStopList = '("auCdl") +simSimulator = "auCdl" +simRunDir = "$RUN_DIR" +hnlNetlistFileName = "$CELL.src.net" +simViewName = "$SCH_VIEW" +simCellName = "$CELL" +simLibName = "$LIBRARY" +incFILE = "$RUN_DIR/source.added" +auCdlNoForwardSlash = t +``` + +```skill +;; simrc +hnlSetBusDirectionDescending = 't +simVerilogGenerateSingleNetlistFile = 't +hnlVerilogPrintSpecparam = nil +simVerilogNetlistExplicit = 't +simPrintInhConnAttributes = t +hnlInhConnUseDefSigName = t +``` + +```skill +;; verilog.env +simLibName = "$LIBRARY" +simCellName = "$CELL" +simViewName = "$SCH_VIEW" +simSimulator = "verilog" +simNotIncremental = nil +simReNetlistAll = 't +simNetlistHier = t +simVerilogLaiLmsiNetlisting = 'nil +verilogSimViewList = '("behavioral" "functional" "system" "verilog" "schematic" "symbol") +simVerilogAutoNetlisting = 't +simVerilogTestFixtureFlag = 't +simVerilogTestFixtureTemplate = "All" +simVerilogNetlistExplicit = 't +hnlVerilogTermSyncUp = "mergeAll" +simVerilogFlattenBuses = 'nil +vtoolsUseUpperCaseFlag = 'nil +hnlVerilogCreatePM = 'nil +simVerilogTopLevelModuleName = "verilog_$CELL.top" +simHierarchyPrefix = "verilog_$CELL.top" +simNCVerilogHierPrefix = "verilog_$CELL:top" +verilogSimStopList = '("verilog" "symbol") +simVerilogPwrNetList = '("$PWRLIST") +simVerilogGndNetList = '("$GNDLIST") +vtoolsifForceReNetlisting = 'nil +simVerilogLibNames = '("$LIBLIST") +vlogifInternalTestFixtureFlag = 'nil +simVerilogBusJustificationStr = "U" +simVerilogTestFixtureTemplate = "All" +simVerilogDropPortRange = 't +simVerilogHandleUseLib = 'nil +simVerilogHandleAliasPort = 't +simVerilogPrintStimulusNameMappingTable = 'nil +simVerilogProcessNullPorts = 'nil +simVerilogIncrementalNetlistConfigList = 'nil +hnlVerilogNetlistStopCellImplicit = 'nil +simVerilogOverWriteSchTimeScale = 'nil +vlogifCompatibilityMode = "4.2" +simVerilogHandleSwitchRCData = 'nil +vlogifUseAssignsForAlias = 't +vlogifDeclareGlobalNetLocal = 'nil +vlogifSkipTimingInfo = 'nil +simVerilogEnableEscapeNameMapping = 'nil +simVerilogStopAfterCompilation = 't +simVerilogVhdlImport = 'nil +simVerilogTopCellCounter = 0 +hnlSupportIterInst = 't +hnlNetlistFileName = "$CELL.v" +hnlSetBusDirectionDescending = 't +simVerilogGenerateSingleNetlistFile = 't +hnlVerilogPrintSpecparam = 'nil +simPrintInhConnAttributes = 't +hnlInhConnUseDefSigName = 't +``` + +### Property Based Removal + +``` +hnlHonorLxRemoveDevice = 't +hnlUserShortCVList = list( list("analogLib" "res") list("tsmcN40" "rnpolywo") ) +```