Monday, November 11, 2013

Mac Setting

How to change default browser?

 

Reference 

[1] http://www.wikihow.com/Change-the-Default-Web-Browser-in-Mac-OS-X

Thursday, November 7, 2013

Pipelined

這在設計組合語言(Assembly Code)是一個另一項觀念,通常我們C語言去撰寫程式再透過Compilar編譯成我們所需要的Machine Code,Compilar都將這些觀念給包裝起來了。

主要的概念精神在於instruction彼此之間在控制硬體時會相互影響。

以RISC pipeline最基本的五個間段為

IF –> ID –> EX –> MEM –> WB

Instruction fetch

Decode

Execute

Memory access

Write Back

這彼此之間會因為硬體設計不同而有所互相影響,

例如Data Hazard問題,在一段時間內不該使用同一個資源,這樣資料同步會出現問題。

簡單來說,第一秒下指令Write寫入資料D到位置A,馬上又在下一秒使用Read去A位置拿資料,但D的值要等到第三秒才能完整的寫入到A位置,此時錯誤的使用Read, Write會得到不預期的錯誤資料。

設計不當會造成下述三個問題,之後有機會再細部陳述這些問題。

Structure Hazards

Data Hazards

Control Hazards

Reference

http://en.wikipedia.org/wiki/Classic_RISC_pipeline

http://www.cs.iastate.edu/~prabhu/Tutorial/PIPELINE/hazards.html

Sinusoid (sine wave)

這裡稍微整理一下思緒,自己對於公式的了解,以及該如何在程式上撰寫。
首先,這裡用C語言來做個驗證,之前是用過Matlab不過時間有點久遠,卻忘了做下筆記。
C語言有提供sin()函式,範圍值 1 ~ -1符合sinusoid的條件。
函式的argument則是填入弳度量(radian measure),跟我們知道的角度(phrase)有些不同。
轉換公式為
弳度量 = 角度量(phrase) * pi / 180
pi = 3.14159285
我們都知道角度量範圍值 0 ~ 360度,之後就是一個循環,這是一個以正旋波為主軸的表示方式。
但場景如果轉換成以時間單位為主軸那該如何表示呢?
就把角度量用時間來區分開來,所以公式就變成
(t(now) * 360 / t) * (pi / 180) 簡化一下,t(now) * 2 * pi / t =  2 * pi * f * t(now)
於是就成為了我們常見的[1]
2 * pi * f * t = wt

Reference
[1]http://en.wikipedia.org/wiki/Sine_wave
http://tw.knowledge.yahoo.com/question/question?qid=1510101414866

Microsoft Visual Studio 2005

程式暫停(主要是讓設計可以觀察結果,或是等待下個操作)
在一般的command prompt可以加入這行指令。
system(“pause”);
在MVS環境下,Ctrl + F5就可以得到相同效果。
Reference
http://stackoverflow.com/questions/193469/how-to-make-visual-studio-pause-after-executing-a-console-app-in-debug-mode

Wednesday, November 6, 2013

Notepad++

 

HEX editor in plug in module

dB (Decibel)

 

簡單來說這是能量的比值表示法[1]。

關鍵詞會鎖定在gain/attenuation

amplitude跟power差一個次方。

常見3dB(2), 6dB(4), 20dB(100)

 

我們都知道C語言math.h[8]當中會有log(), log2(), log10()函式可以使用,

而這些函式是如何設計實現呢?

或換言之,在嵌入式系統中,我們該如何在有限的資源裡轉換dB值呢?

這都是一門技術。

這裡先簡單帶過之後有時間再做詳細介紹。

主要是透過Taylor expansion[4]和logarithm rule[3],透過一些誤差犧牲而換取有效的得到轉換值所產生的。

自然函數能利用Taylor expansion來呈現,若要轉換基底就透過一些對數規則[3]做轉換。

透過觀察[4]我們能知道Taylor expansion對於自然對數的呈現,若N級數很大的情況下在-1 ~ 1之間較為精準,若級數較小時-0.5 ~ 0.5較為精確。

 

Reference

[1]http://en.wikipedia.org/wiki/Decibel

http://en.wikipedia.org/wiki/Logarithm

[3]http://www.rapidtables.com/math/algebra/Logarithm.htm

[4]http://en.wikipedia.org/wiki/Taylor_series

http://en.wikipedia.org/wiki/Common_logarithm

[6]http://mathworld.wolfram.com/NaturalLogarithm.html

http://en.wikipedia.org/wiki/Natural_logarithm_of_2

[8]http://www.codecogs.com/library/computing/c/math.h/log.php

http://stackoverflow.com/questions/15967240/fastest-implementation-of-log2int-and-log2float

http://stackoverflow.com/questions/9411823/fast-log2float-x-implementation-c

Sunday, November 3, 2013

gcc for Window

GCC是一套好用的編譯器,想要設計簡單的程式用這就對了~~
Download mingw-get and simply issue:
mingw-get install gcc.

See the Getting Started page.
Reference

http://stackoverflow.com/questions/6394755/how-to-install-gcc-on-windows-7-machine

Register Transfer Level Design with Verilog (1) [ebook]

設計程式之所以有趣不外乎是它的千變萬化,同樣的結果卻有不同的寫法。 但這些不同寫法當中也並沒有分誰對誰錯,也沒有制定標準來規範何事該用何解。 這也就是我們設計者的珍貴!! [1] Primitive Instantiations 在Verilog中最基本的邏輯...