Tuesday, July 11, 2017

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

設計程式之所以有趣不外乎是它的千變萬化,同樣的結果卻有不同的寫法。

但這些不同寫法當中也並沒有分誰對誰錯,也沒有制定標準來規範何事該用何解。

這也就是我們設計者的珍貴!!

Screen Shot 2013-01-20 at 9.58.41 PM





[1] Primitive Instantiations

在Verilog中最基本的邏輯閘便稱為Primitive,使用最基本的primitive為基礎來設計別稱Primitive Instantiations。

Screen Shot 2013-01-20 at 3.56.46 PM




[2] Assign Statements

透過Primitive gates在利用assign將結果牽線別有更多變的結果。

Screen Shot 2013-01-20 at 4.05.52 PM



[3] Conditional Expression

顧名思義,就是條件式的表示方法!這也是能將硬邦邦的硬體注入多變思想的刀刃。

Screen Shot 2013-01-20 at 4.04.09 PM



[4] Procedural Blocks

至於這套程序則是非常高接的處理程序,往往是很多Conditional Expression所組成。

Screen Shot 2013-01-20 at 4.04.28 PM




所有教課書不往往儘說這些道理,但這些確有哪些不同呢?其實在我的見解就如下

[1]就是利用最基本的邏輯閘組成所需的系統。

[2]的概念就與數學相似,利用運算元來表示系統。

[3]條件是就有如黑盒子概念,拿數位邏輯的概念來說,就是將系統使用Boolean Expressions來呈現,輸入與輸出的關係就有如條件班達成。

[4]則是透過程序流程來分析結果,當然所耗的資源都不盡相同。

Reference

<1>Verilog Digital System Design - RT Level Synthesis, Testbench and Verification

Monday, August 15, 2016

RF in IOT

      最近開始研究起RF通訊這方面的資訊,目前大家都鎖定在IOT這個區塊,各家大廠都推出屬於自己的協定來因應產品需求,好比Apple Homekit,Google Brillo。但由於各家都有各自條件優勢,所以對於這整塊市場還在群雄爭霸當中。
       基本上經過了解後發現這幾項技術還在開發階段,所以目前相關的文獻跟發展都還沒有到穩定成熟的狀況,也就是代表還有很多可以值得細玩的技術,此外切入門檻相對許多大系統這是比較容易許多,不過,卻可以增加不同產業的產品功能性,就好比醫療產業(透過藍芽或wifi做資料顯示傳送,省去許多空間)。
      技術層面來看硬體不外乎的就是在意耗電流以及RF的電路,至於訊號是屬於FSK, GSK, PSK, QPSK, DQPSK[5],就不列入細部考慮,畢竟這是一項時間,空間,能量的平衡槓桿,沒有對與錯沒有是與非,在應用的角度上會有各自的優勢,然而軟體就是需要瞭解藍芽的協定或是其他協定(Thread)[4],但以目前IOT所要結合網際網路的趨勢是在IPV6,主要是在於它相較TCP/IP,IPV4來說有更多的位址可以使用,但目前卻還有存在相對的風險[3]。
       其實在軟體方面有許多很好的切入點及應用是值得深入研究發展。

Reference
[1]http://www.nordicsemi.com/eng/About-us
[2]NordicSemi-eBook-IoT-Opportunity-Risks-Strategy
[3]http://blog.nordicsemi.com/getconnected/is-the-internet-ready-for-iot
[4]http://www.2cm.com.tw/markettrend_content.asp?sn=1512030005
[5]https://en.wikipedia.org/wiki/List_of_2.4_GHz_radio_use

Saturday, December 27, 2014

Getopt

#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int
main (int argc, char **argv)
{
int aflag = 0;
int bflag = 0;
char *cvalue = NULL;
int index;
int c;

opterr = 0;
  while ((c = getopt (argc, argv, "abc:")) != -1)
switch (c)
{
case 'a':
aflag = 1;
break;
case 'b':
bflag = 1;
break;
case 'c':
cvalue = optarg;
break;
case '?':
if (optopt == 'c')
fprintf (stderr, "Option -%c requires an argument.\n", optopt);
else if (isprint (optopt))
fprintf (stderr, "Unknown option `-%c'.\n", optopt);
else
fprintf (stderr,
"Unknown option character `\\x%x'.\n",
optopt);
return 1;
default:
abort ();
}
  printf ("aflag = %d, bflag = %d, cvalue = %s\n",
aflag, bflag, cvalue);

for (index = optind; index < argc; index++)
printf ("Non-option argument %s\n", argv[index]);
return 0;
}

Here are some examples showing what this program prints with different combinations of arguments:

% testopt
aflag = 0, bflag = 0, cvalue = (null)

% testopt -a -b
aflag = 1, bflag = 1, cvalue = (null)

% testopt -ab
aflag = 1, bflag = 1, cvalue = (null)

% testopt -c foo
aflag = 0, bflag = 0, cvalue = foo

% testopt -cfoo
aflag = 0, bflag = 0, cvalue = foo

% testopt arg1
aflag = 0, bflag = 0, cvalue = (null)
Non-option argument arg1

% testopt -a arg1
aflag = 1, bflag = 0, cvalue = (null)
Non-option argument arg1

% testopt -c foo arg1
aflag = 0, bflag = 0, cvalue = foo
Non-option argument arg1

% testopt -a -- -b
aflag = 1, bflag = 0, cvalue = (null)
Non-option argument -b

% testopt -a -
aflag = 1, bflag = 0, cvalue = (null)
Non-option argument -

An option character in this string can be followed by a colon (‘:’) to indicate that it takes a required argument. If an option character is followed by two colons (‘::’), its argument is optional.


This optarg is set by getopt to point at the value of the option argument, for those options that accept arguments.


 


Reference


[1] http://www.gnu.org/software/libc/manual/html_node/Using-Getopt.html


[2] http://www.gnu.org/software/libc/manual/html_node/Example-of-Getopt.html


[3] http://en.wikipedia.org/wiki/Getopt

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

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