Oh! You closed up the window, so you cannot see raining

[Hugo] 使用 Hugo-notice

Shortcodes 介紹 Shortcodes 是內容檔案中的一個簡單片段,Hugo將使用預先定義的範本對其進行呈現。 除了更乾淨的 Markdown 外,Shortcodes 還可以隨時更新新的技術或標準。 Notice shortcodes 將以下程式碼加入到 Hugo 專案底下的 layouts/shortcodes/notice.html {{/* Available notice types: warning, info, note, tip */}} {{- $noticeType := .Get 0 | default "note" -}} {{/* Workaround markdownify inconsistency for single/multiple paragraphs */}} {{- $raw := (markdownify .Inner | chomp) -}} {{- $block := findRE "(?is)^<(?:address|article|aside|blockquote|canvas|dd|div|dl|dt|fieldset|figcaption|figure|footer|form|h(?:1|2|3|4|5|6)|header|hgroup|hr|li|main|nav|noscript|ol|output|p|pre|section|table|tfoot|ul|video)\\b" $raw 1 -}} {{/* Count how many times we've called this shortcode and load the css if it's the first time */}} {{- if not ($....

<span title='2024-01-19 01:26:30 +0800 +0800'>January 19, 2024</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;Rain Hu
Oh! You closed up the window, so you cannot see raining

[VHDL] Verilog Hardware Description Language

1 Verilog HDL 1.1 Verilog 簡介 一套硬體描述語言 輔助設計數位系統 描述電路的行為 電子自動化工具 類似C語言的硬體描述語言 易學、容易接受 高階行為描述 切勿使用軟體思維(循序)撰寫(硬體描述語言多是並行的) 支援多種硬體層級的描述方式 從低階到高階模式 依照不同的方法設計 支援階層式的設計方法 樹狀式的設計結構 由繁化簡 1.2 Verilog 的模型 1.2.1 電晶體層級 Transistor Level 或低階交換層次模型(Switch Level Model) Verilog 最低階的層次模型 電路是由開關與電晶體所組成 一般不會採取低階的層級來進行設計 1.2.2 邏輯閘層級 Gate Level 使用基本的邏輯閘元件 AND、OR、NOT 邏輯電路圖 1.2.3 資料流層級 Data Flow Level 描述電路中資料的處理方式 資料如何在電路中運算及傳送 輸入持續驅動輸出 運算式 如:out = a + b + c 1.2.4 行為模型 Behavior Level Verilog 最高階的層次模型 不需考慮硬體元件的特型,只需放在模組的功能描述 很像 C 語言 合成軟體工具 1.2.5 結構式模型 Structure Level 引用硬體模組的模式 類似邏輯閘層次模型 支援階層式設計法 將複雜電路分為層狀結構 架構上類似樹狀結構 Bottom-up:元件→子模組→設計目標 Top-Down:設計目標→子模組→元件 Mixed:設計目標→子模組←元件(常用於大型複雜系統) \( \boxed{\text{Full Adder}} \begin{cases} \boxed{\text{Half Adder}} \begin{cases} \boxed{\text{XOR}}\\ \boxed{\text{AND}} \end{cases}\\ \boxed{\text{Half Adder}} \begin{cases} \boxed{\text{XOR}}\\ \boxed{\text{AND}} \end{cases}\\ \boxed{\text{OR}} \end{cases}\\ \text{設計目標}\qquad\qquad\text{子模組}\qquad\text{元件} \) 1....

<span title='2022-05-01 17:37:22 +0800 +0800'>May 1, 2022</span>&nbsp;·&nbsp;4 min&nbsp;·&nbsp;Rain Hu
Oh! You closed up the window, so you cannot see raining

[Logic Design] Lec 01 - 數字系統與轉換

數位系統與開關電路 在現實世界中,資訊是以類比(Analog)的方式傳遞的,換言之,資訊是連續的 在電腦世界中,資訊是以數位(Digital)的方式傳遞的,也就是開與關或是0或1。 A/D <-> DSP(digital signal processor) <-> D/A Switching Circuit 可分為三個層級: System: 模組Modules、算術運算單元 ALU(Arithmetic logic unit)、記憶體 Memory Logic:邏輯閘(gates) Circuit:電晶體(transistors) 經由 switching network 的設計,可將輸入轉成合乎 spec 的輸出。其中 switching network 的種類包含: Combinational network 輸出是輸入的函數,且表達當下的值。 Sequential network 輸出是輸入的函數,可以表達當下的值或是過去的值。 具有記憶體的行為 Switches 由電晶體來實現 transistor level, gate level, module level… 數字系統與轉換 在現實世界中,最普遍使用的數字系統為十進制(Decimal) 然而在電腦世界中,因為只有代表開與關的 0 與 1,故使用的數字系統是以二進制(Binary)為基礎。 \(N=(a_2a_1a_0)_R=a_2\times R^2+a_1\times R^1+a_0\times R^0\) 負數 N 正數表示 -N 正數加負號 1的補數 2的補數 +0 0000 -0 1000 1111 N/A +1 0001 -1 1001 1110 1111 +2 0010 -2 1010 1101 1110 +3 0011 -3 1011 1100 1101 +4 0100 -4 1100 1011 1100 +5 0101 -5 1101 1010 1011 +6 0110 -6 1110 1001 1010 +7 0111 -7 1111 1000 1001 +8 N/A -8 N/A N/A 1000 二進制算數 當兩數相加或兩數相減時,超過可用bits數時會發生overflow, 例如-3+-4=-4是OK的 但-5+-6=-11會產生溢位 二進制的表達方式 Binary codes Decimal Digit 8421 Code(BCD) 6311 Code Excess-3 Code 2-out-of-5 Code Gray Code 0 0000 0000 0011 00011 0000 1 0001 0001 0100 00101 0001 2 0010 0011 0101 00110 0011 3 0011 0100 0110 01001 0010 4 0100 0101 0111 01010 0110 5 0101 0111 1000 01100 1110 6 0110 1000 1001 10001 1010 7 0111 1001 1010 10010 1011 8 1000 1011 1011 10100 1001 9 1001 1100 1100 11000 1000 Weighted Codes 8421 Code 與 6311 都是 Weighted Code,代表每4個bit,各自代表的數字, 例:1011 for 8421 = 8 + 0 + 2 + 1 = 11 例:1011 for 6311 = 6 + 0 + 1 + 1 = 8 Excess-3 Codes Excess-3 是以 8421 Code 為基礎下,額外加 3。 使得 i 與 10-i 互為 1 的補數, 0 與 9 為補數。(0011 與 1100) 1 與 8 為補數。(0100 與 1011) 2 與 7 為補數。(0101 與 1010) 3 與 6 為補數。(0110 與 1001) 4 與 5 為補數。(0111 與 1000) Gray Codes 兩相鄰的數只會相差一個 bit 又名 Reflected Binary Codes(RBC)、Unit distance code、Minimum error code 可以減少 switching operation 如何轉換 Gray Code?...

<span title='2021-09-18 03:11:35 +0800 +0800'>September 18, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;Rain Hu
Oh! You closed up the window, so you cannot see raining

[Logic Design] Lec 02 - 布林代數

基本邏輯運算 Logic Gates Not Gates Symbol Truth Table \( \def\arraystrecth{1.5}\begin{array}{|c|c|}\hline \text{X}&\overline{\text{X}}\text{or}\text{X’}\\\hline 0&1\\\hline 1&0\\\hline \end{array} \) And Gates Symbol Truth Table \( \def\arraystrecth{1.5}\begin{array}{|c|c|c|}\hline \text{X}&\text{Y}&\text{Z=X}\cdot\text{Y}\\\hline 0&0&0\\\hline 0&1&0\\\hline 1&0&0\\\hline 1&1&1\\\hline \end{array} \) Or Gates Symbol Truth Table \( \def\arraystrecth{1.5}\begin{array}{|c|c|c|}\hline \text{X}&\text{Y}&\text{Z=X+Y}\\\hline 0&0&0\\\hline 0&1&1\\\hline 1&0&1\\\hline 1&1&1\\\hline \end{array} \) 布林表達式與真值表(Boolean Expression and Truth Table) Boolean expression 用 ' 代表 NOT 用 + 代表 OR 用 . 代表 AND 將輸入用上面的運算子表示成算式,如:\((A+C)(B’+C)\) Truth Table \( \def\arraystrecth{1.5}\begin{array}{ccc|cccccc} A&B&C&B’&AB’&AB’+C&A+C&B’+C&(A+C)(B’+C)\\\hline 0&0&0&1&0&0&0&1&0\\ 0&0&1&1&0&1&1&1&1\\ 0&1&0&0&0&0&0&0&0\\ 0&1&1&0&0&1&1&1&1\\ 1&0&0&1&1&1&1&1&1\\ 1&0&1&1&1&1&1&1&1\\ 1&1&0&0&0&0&1&0&0\\ 1&1&1&0&0&1&1&1&1\\ \end{array} \) 基本運算定理 NOT gate 的基本運算定理 \( \boxed{ \def\arraystretch{1....

<span title='2021-09-18 03:11:35 +0800 +0800'>September 18, 2021</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;Rain Hu
Oh! You closed up the window, so you cannot see raining

[Logic Design] Lec 03 - Minterm 與 Maxterm 展開

布林表達式的轉換 將文字敘述轉換成布林表達式: \( \def\arraystrecth{1.5}\begin{array}{l} \underbrace{\text{The alarm will ring}}_ {Z} \text{ iff } \underbrace{\text{the power of alarm is on}} _{A} \text{ and } \underbrace{\text{the door is not closed}} _{B’} \\ \text{ or } \underbrace{\text{it is after 6 p.m.}} _{C} \text{ and } \underbrace{\text{the window is not closed}} _{D’} \end{array} \) \(Z=AB’+CD’\) 由真值表開始建構邏輯電路 Truth Table: \( \boxed{ \def\arraystretch{1}\begin{array}{ccc|c|c} A&B&C&f&f’\\\hline 0&0&0&0&1\\ 0&0&1&0&1\\ 0&1&0&0&1\\ 0&1&1&1&0\\ 1&0&0&1&0\\ 1&0&1&1&0\\ 1&1&0&1&0\\ 1&1&1&1&0 \end{array} } \) 利用 1’s 的函數...

<span title='2021-09-18 03:11:35 +0800 +0800'>September 18, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;Rain Hu