Automation without abstraction is like a bicycle without pedals

Automation is just transforming information from one format to another format, it won’t make the information any easier to work with. Abstraction drops irrelevant information and keeping only the useful information at the right layer. Abstraction can scale vertical, automation can only scale horizontally.

Design and Reuse, by David Murray

I’ve noticed recently that the word ‘automation’ can be used very loosely in the EDA industry as a presumption of productivity and quality. I’ve recenlly been working with some legacy customer flows on an IP integration process that was 100% ‘automated’ from an Excel sheet. This excel sheet was written to CSV text file which was then parsed with perl to create an RTL output. As the solution evolved however and the requirements grew more complex, another set of perl scripts were deployed which directly manipulated the RTL file. In fact this perl included some snippets of RTL code to insert into the output. So while technically the process was 100% automated, theis type of textmanipulation brought the level of abstraction lower even than the RTL level. I came across similar types of ‘automation’ in my previous life as a design engineers life, where automation was considered the ability to record keystrokes macros within a text editor. Again this automation was at a very granular and low level of abstraction and consisted of no more than creating repeatable, but not very reusable small steps. No matter the claimed level of automation of a process, a simple fact remains; automation without abstraction is like a bicycle without pedals.
A bicycle without pedals!

The Laufmaschine or ‘running machine’, a brilliant concept, was realized by German, Baron von Drais in 1817. Described as “A mechanical machine with two, in-line wheels and the ability to steer”, the Laufmaschine could get you from A to B in a more efficient fashion and it meant keeping both feet on the ground (and probably a new set of shoes every week). At initial trials, the laufmaschine was able to get running speeds at walking efficiency. This laufmaschine was also called a velocipede, meaning ‘fast foot’ as well as swiftwalker (a marketing term if there ever was one). Its goal was to make walking or running more efficient and it successfully achieved this.

In 1863, Frenchman Pierre Lallement modified a two-wheeler in Paris and attached pedals, forever changing the concept. The introduction of the pedal took the fast-walking to a new level . With the advent of gears, the efficiency of man travelling was catapulted way ahead of our counterparts in the animal kingdom. Man on a pedal-enabled bicycle was100 times more efficient than man walking. Man was now CYCLING!

So how does this relate to SoC realization and IP integration? As the number of connections required to assemble a system grew, manual connectivity was replaced with in-house (as well as outhouse!) scripting solutions without really changing the assembly concept. The scripts – be they Excel VBA, perl or python were performing low-level data manipulation rather than high level automation abstraction. There were still trying to deliver better walking efficiency.

These scripted solutions are essentially ‘swift-stitch’, or ‘veloci-wire-up’ style environments performing low-level connectivity manipulation. As the complexity inevitably increases, the levels of efficiency of scripting simply aren’t scaling. A new concept is needed for IP integration; a higher level of abstraction is needed to boost the SoC realization process.

So, what did we learn from the laufmaschine? With pedals, Mr Lallement found a way of synthesizing one motion into another, increasing efficiency by an order of magnitude in the process. Pedals were in fact a very small but highly significant change to the methodology – CYCLING was the result! We need the same paradigm in SoC realization where we replace adhoc IP stitching type of solutions and change to a new methodology called ‘weaving’.

Like pedals, ‘weaving’ doesn’t seem like a massive leap in innovation but it gives a quantum leap in efficiency. Weaver takes what these integration scripts were doing time and time again and abstracts it up to a specification language that defines how to integrate IPs and systems.
Weaving

The key to this solution is a simple but powerful IP integration specification language that allows engineers to specify a high level integration specification as a set of rules that define how IP is integrated. These rules contain powerful assembly instructions and link with formal port/interface definitions, such as IP-XACT.

This rule when run on a sub-system containing multiple IP instances will export any ports that have been formalized through attributes or IP-XACT. The selected ports will be created on the sub-system boundary and connected to the originating instances. It will also maintain any packaging metadata that was stored with the ports e.g. properties, IP-XACT interface mappings etc.

The export instruction has a range of options that control the intended port creation. Other instructions include, connect, tieoff, group/split (for hierarchical manipulation), etc. and work at both the port or interface level. An integration specification can therefore be considered a collection of these rules

How can such a small change in abstraction lead to massive efficiency gains?

A rule can be reused multiple times on many sub-systems and also on multiple projects. Therefore the reuse potential is huge. Also the design intent is very clear and concise and easy to understand review. In a sample peripheral sub-system, 3 rules (with 9 instructions) auto-generates 1434 lines of structural HDL code. Similarly at the top-level of a large chip, 21 rules (120 instructions) gives 11188 lines of HDL, an average of 96 lines of HDL code created, per instruction. (Much like 1 revolution of the pedals giving you 100m in distance!)

Specifications and Scripts

The specification language is easy to understand and familiar to people working in the domain . There are only a handful of instructions to learn. So what is the difference between specifications and scripts?

* Rules are executable, synthesizable specifications whereas scripts tend to be ad-hoc implementations.
* Specifications by their nature captures design intent and raise the design abstraction. The design intent can be very clear. Scripts are low level and design intent cannot be as clear.
* Specifications are more formalised and are more stable than the resulting implementation. Scripts tend to be very implementation specific and implementation sensitive.
* Rules are essentially specifications whilst scripts are code

Scripting will always play a role in design automation and should be considered the essential glue of a process. Scripts should handle corner cases, tweaks and nuances but because of their ad-hoc nature and its resulting instability and unpredictability, script should be kept to a minimum and not form the central part of an integration flow. Scripts offer flexibility and a way to get out of certain holes but long-term, strategic solutions require a more automated AND abstracted solution. Scripting gives a context of what you are trying to do with the data and because of this it provides a pointer as to where the automation is going, probably much like what went through the Frenchman’s mind when he envisaged pedals. He would probably not have come up with a bicycle without first seeing the original laufmaschine.

It is time to raise the level of abstraction and aim to finally become 100 times more efficient at the IP integration process.

人形軟件卷一:靈魂上載 – 譚劍

用中文寫作的科幻小說作家鳳毛麟角﹐譚劍大慨是香港絕無僅有的土產科幻小說作家。自從倪匡封筆以後(如果衛斯理也算是科幻的話)﹐香港的科幻界差不多完全進入真空。去年譚劍憑《黑夜旋律》贏得台灣九歌文學獎﹐使他踏出寫作的重要的一步﹐放棄IT的高薪厚職﹐全情投入科幻小說創作之中。時隔一年他的新書《人形軟件》終於面世﹐而且還是以連載故事的形式出版﹐看來他有滿肚子的寫作大計﹐準備寫一系列人形軟件的小說。

上次《黑夜旋律》全香港書店也沒入貨﹐今次的《人形軟件》卻很醒明地放在流行小說一欄﹐可見譚兄的努力續漸被讀者肯定和接受。《人形軟件》節奏明快﹐主線直線發展﹐沒有前作故弄玄虛的老病﹐讓我閱讀時放不下書來﹐一氣呵成追書十分過癮。雖說這是科幻小說﹐其實題材比較接近輕小說類型﹐角式和場面設計很重動漫感。大慨硬科幻在香港市場太小﹐還是以輕科幻為包裝﹐加入日本美女黑客﹐虛擬銅鑼灣九一一大爆炸﹐黑客集團打劫網絡獅子銀行等元素﹐讓普通讀者也能享受書中的情節。

當然作者譚劍兄骨子裏流的是硬科幻的血﹐在緊張激刺套俗的小說情節之間﹐充滿電影影像式的鏡頭描述背後﹐其科幻what-if的主題仍然清晰可見。人工智能軟件﹐虛擬人格﹐網上代理人等等﹐不是譚兄原創的新鮮事物﹐在外國科幻小說﹐如Terminal Experiment﹐Getting to Know You早已提及。譚兄把這些熟口熟面的科幻橋段﹐加入讓讀者陪感親切的香港色彩。以虛擬人格作為小說的主角﹐故事在本尊逝世後才展開﹐也是很破格的創新手法。故事主線有些像Broune Identity﹐主角沒有主人真正身份的記憶﹐卻在主人死後被人追殺﹐抽絲剝繭解開背後驚天大劫案的陰謀。

故事主線不外是追趕跑跳碰﹐可是過程中申引出很多對未來科技的反思。女主角天照百份百是動漫跑出來的人物﹐她愛上只是虛擬人格的主角。人與電腦戀愛本身已可以是一個深入發揮的題材﹐可以借此探討戀愛的本質﹐若愛是靈魂與靈魂交流﹐若人的靈魂上載至電腦﹐那愛情又是否可以無分物質界限。可惜譚劍兄一介老男人﹐恐怕不擅於描寫細膩的愛情﹐看不出天照是愛上主角﹐還是想保護本尊僅存的一點靈魂血脈。今次少年漫畫式的點到既止的愛情觀﹐總好過上次大灑鹽花露骨地寫性愛。

後半部把主角的人工智能上載至機械人身上﹐讓他從網絡逃出來到現實世界﹐以情節編排來收線結局無可原非。但結尾時才忽然加入機械人元素﹐與全書一直在塑造的世界觀有點格格不入。如果有智能機械人的話﹐小說的世界在細節之處應有不同的安排﹐可以加插人腦與電腦﹐肉身與機械人之間﹐不同關係的側寫描述。

看書後第二卷的預告﹐鼓吹人類應該捨棄肉身﹐完全融入網絡的魔神教將會成為新反派。在今集魔神教只是客串出場﹐為主角題供逃過追殺的避難所﹐魔神教教主蝶神與主角的換動不多﹐沒有好好清楚表達魔神教的教義。在電影Matrix中﹐人類要逃離電腦的虛幻世界﹐魔神教反而主張人類要擁抱虛幻世界﹐謂虛幻世界中可以解決真實世界上的所有問題。其邏輯與高達中馬沙的地球淨化論相同﹐也都是認為把地球上的人殺光了﹐就可以解決問題地球自然就會回復原貌。可是若把人類從現實中割離﹐只讓人類活在電腦的虛擬世界中﹐那與殺光所有人根本沒有分別﹐只不過是否有留下一個拷貝矣。

正所謂不怕生壞命﹐最怕改壞命﹐好端端的一個網絡極端宗教組織﹐給譚兄改了魔神教這麼老土的一個名字﹐怪不得在書中他們好像沒有什麼信眾。捨棄肉身只保留思想本身不一定是壞事﹐但捨棄肉身不等於可以捨棄物質世界﹐靈魂也要在電腦中才可以運行。人只不過把生物學的肉體﹐轉變成電腦硬件的肉體矣﹐思考效率可能提高了﹐物質需要也可能減少了﹐但始終還是不能完全無視能量轉換定律的物理法則。

《人形軟件》最大敗筆﹐便是無視電腦和網絡也要尊守的物理法則﹐書中的虛擬世界似是奇幻多於科幻﹐網絡好像是憑空建造一樣﹐可以完全無視現實世界的限制。姑勿論網絡傳送速度快慢這些低級技術問題﹐書中完全沒有提及是虛擬人格到底是那裏在運行。就算是雲端電腦也有地理位置。光柵傳送是只連結輸出輸入埠﹐還是把整個智能程式抄過去新主機。如果是抄程式資料的話﹐那在舊主機的資料如何處置。如果可以留多一個拷貝﹐就不用村上春樹病毒來分身這麼麻煩了。當然若果要顧及現實性合不合理﹐情節便不能隨心所欲地天馬行空發揮﹐讀起來也不會有現在這麼強烈的動畫感。可是正正因為譚兄沒有費心解決這些細節﹐《人形軟件》只是披上科幻外衣的輕小說﹐與傳統硬派科幻小說還有一段距離。

在香港當作家不容易﹐當一個科幻小說作家更難﹐譚兄堅持這條難行之路﹐其誠意可嘉值得買書支持。從他的網誌中讀到﹐《人形軟件》第二卷已經完稿﹐希望快些交給出版商印刷出版﹐讓我可以續繼追看故事發展。

The A-Team 通天奇兵

八十年代配音電視劇風行一時﹐《通天奇兵》曾經是我童年最愛的劇集﹐每個週未準時扭開電視﹐看水牛﹐霹靂仔﹐鈍胎﹐喪榮﹐如何化廢物為武器﹐替天行道警惡懲奸。當年流行的電視劇相繼被搬上大銀幕﹐在《神探俏嬌娃》取得票房好成績後﹐我便一直期待《通天奇兵》何時推出電影版。

上一代的原裝人馬早已退休﹐我最喜愛的角色Mr.T更不幸逝世﹐新版的《通天奇兵》換上新面孔﹐難得是新演員形神俱似﹐保持舊版緊張刺激有打有笑的神髓﹐連四人組的專用坐駕黑色Van仔也有出場﹐只是新版鈍胎略嫌不夠大隻。當年的四人組是越戰老兵﹐新版追上時代改為伊拉克戰爭。今次是荷里活A級大製作﹐當然比當年電視的土炮特技精彩百倍﹐炸藥落足本錢務求給觀眾最勁的爆炸場面。

這套電影算是有個故事吧﹐在伊拉克戰爭末期﹐四人組奉密令深入把格達﹐搶奪運鈔車和印銀紙的電鍍板。怎料任務成功回來後﹐電鍍板被壞人起尾注偷去﹐唯一知道密令的將軍又被暗殺﹐四人組被軍事法庭判罪收監。區區監獄又怎能困著通天奇兵﹐四人組誓要逃獄查出真兇﹐奪回電鍍板還他們一個清白。不理劇情中所有不可能發生的考合﹐故事勉強上說得通兼十分簡單易明。其實故事是什麼不重要﹐重要是可以串連起二個小時不斷的動作場面。

從墨西哥組成四人組打擊毒犯開始﹐電影便是一幕接一幕的爆炸﹐完全沒有冷場。預告片中的飛天坦克最神﹐從爆炸的運輸機掉出來﹐不單可以空中擊破戰鬥機﹐竟然還可以用主炮連射地面作減速﹐跌落湖中安全著陸。最後一場碼頭大戰﹐打到連貨櫃船也沉沒﹐連我這麼愛看爆炸的觀眾﹐也不禁問是否爆得太過跨張。不過只要打得好看那管他合不合理﹐反正當年舊版也是娛樂先行﹐《通天奇兵》從來也不是劇情片嘛。

儘管四人組最後把壞人繩之於法﹐但為證明自己是清明而逃獄本身已經犯法﹐他們再一次被軍法過橋抽板送去監獄。片末四人組再次從囚車逃出﹐承接舊電視版四人組當聯邦通緝犯的開始。雖然大部份影評把這電影批評得一文不值﹐可是《通天奇兵》舊粉絲卻大都拍手叫好。那些懶藝術懶有深度的影評人﹐他們根本不明白原裝電視版的精神﹐帶著他們有色眼鏡來看﹐自然不懂得欣賞無腦爆谷電影的奧妙之處了。

金錢的故事 The Ascent of Money – Niall Ferguson

上次去印度時買了這本《金錢的故事》﹐想不到閱讀進度甚慢﹐時隔半年又回到印度出差﹐才有時間讀全本書寫書評。雖有這本書的名稱說是關於金錢﹐正確點來說是關係金融體係發展的歷史。作者是哈佛大學教授﹐應PBS電視台邀請﹐拍攝講述金融歷史的記錄節目。電視節目叫好叫座﹐作者亦順勢把節目內容整理出書﹐六集節目變為書中的六章。由於從電視節目改篇成書的關係﹐這本書讀起來十分容易﹐不過內容則受原裝電視節目結構的限制﹐每一章也是個獨立單元﹐讀起來缺乏連貫性。內容為遷就電視觀眾的水平﹐加入很多有趣的歷史故事﹐但前因後果的歷史分析則相對較弱。

第一章開完名義﹐講述金錢的歷史和銀行的誕生﹐從古代銅錢貨幣開始說起﹐到中世紀以貴重金屬作為媒介﹐到來各國發行紙幣取代金屬﹐到近代索性取消貨幣黃金本位﹐到最後金錢連實體也失去﹐變成電腦內的一堆數字。作者引用大量歷史資料﹐指出金錢在歷史中的重要性﹐十字東征是其中一個原因﹐是歐洲大量流失貴重金屬﹐導致貨幣供應短缺。到殖民地時代的西班牙﹐因發現印卡王國的白銀寶庫﹐一船船把白銀運回國引致嚴重通貨棚漲﹐最後弄至經濟一廞不振﹐衰失海上霸主的地位。後半段介紹文藝復興時期的Mediccis家族﹐當年的銀行主要是做貨幣對換的生意﹐利用消息靈通時間上的優勢﹐以猶太人的身份和一個家族的緊密連繫﹐發展出橫跨歐洲各國﹐富可敵國的跨國銀行。最初銀行只做存錢和商業交數﹐到了十七世紀端士銀行發明借錢﹐在假定有存戶不會同時間提出所有存款的前題下﹐銀行可以把收到的存款借出賺取利息。以前銀行主要收入靠收取手續費﹐現代的銀行已轉型變為資產和風險管理。

第二章講述債卷的誕生﹐債卷是國家向人民或外國的借錢的工具﹐最初發行主要用來支付戰爭開支。戰勝國自然有能力償還債卷﹐戰敗國的債卷則變成癈紙﹐當年買債卷可以說是在賭那個國家會打勝仗。在歐洲各國還在打來打去的年代﹐出了一名債卷專家Rothschild﹐包攬各國債卷的發行和行銷。因為戰爭說到底也是在拼財力﹐Rothschild的債卷決定足以左右一個國家的命運﹐美國內戰中南方運戰敗的其中一個原因﹐便是因為經濟實力比北方差﹐而又借不所行軍打仗所需的資金。到了十九世紀殖民地時代﹐殖民地發行的債卷﹐竟然比宗主國還有更高的評級。債卷的評級取決於還款能大﹐宗主國軍力強大很難迫他還錢﹐但殖民地債卷在宗主國有很多債主﹐宗主國有實際統治權﹐不怕殖民地走數壞賬。

第三章講述股票﹐在股票出現以前﹐公司與擁有公司的那個人關係不可分割﹐有了股票能分散公司的擁有權﹐識公司可以在市場上集資。最初的股票發行的是荷蘭的遠洋商船隊﹐因為風險大但利潤高﹐才想到以發行股票的形式去集資﹐發放股息分享利潤﹐並設立股票交易市場﹐讓想套現的人買賣股票。因為荷蘭海軍實力強大﹐遠洋商船隊是很好的投資﹐直致荷蘭的海上霸權被英國取代﹐股票的升幅高達每年27%。有股票自然會有泡沬﹐史上第一個泡沬由英國人John Law發明﹐他游說到法國皇帝給他北美殖民地的貿易專營權。他的公司用優厚股票吸引投資者﹐但本身只是一個錢滾錢的龐底騙局。他的公司因為有皇帝撐腰﹐吸引很多貴族投資﹐讓他結交政治勢力﹐還讓他當了法國的財相。泡沬最後爆煲是經濟定律﹐他既然身為法國財相﹐有能力左右法國的貨幣政策﹐便想透過貶值來阻止泡沬爆破﹐結果把法國的經濟弄得一團糟﹐埋下法國大革命的導火線。這章最後一節﹐講述本世紀華爾街股票的興衰﹐不過這些陳年歷史因為近年金融海嘯﹐早已給傳媒翻炒了多次。

第四章講述保險的發明。現在保險推銷員人見人憎﹐想不到最初保險竟然教會發明﹐用意是照顧意外離世牧師﹐遺留下來的弧兒寡婦。後來蘇格蘭人把保險應用在航運上﹐為出航的船隻提供天災人禍的保障。在發明統計學以前﹐賣保險與賭錢沒有分別﹐蘇格蘭人精於計算﹐很快便把統計學應用在保險上﹐以人口壽命計算出風險與保費的關係。蘇格蘭的寡婦基金﹐更一度是英國最大的投資公司﹐後來演變成今天的保險公司。醫療保險和年老退休保險﹐今天是左派社會福利主義的招牌﹐估不到竟然是極右派納萃德國和軍國主義的日本發明。社會福利制度的邏輯很簡單﹐國民要身體健康軍隊才會強大﹐對未來生活有潼景﹐才會為國家效忠。賣命。本世紀統計數學上有重大突破﹐直接速成風險管理基金的興起。

第五章講樓市﹐香港地產只有個炒字。估不到在歷史上﹐地產與民主原來有直接關係。英美的民主發展﹐很大程度上是源於市民要保護個人資產的需求。而民主推行的初期﹐只有樓在手的市民﹐才擁有投票權。金融海嘯源於次按﹐作者也花了很長篇幅講述按揭市場的歷史﹐並追朔美國兩大房貸公司﹐最初以追求全民有樓政治任務才成立的歷史。市民擁有房屋不單是經濟問題﹐更可以影響社會文化﹐對自由和個人權利的取態。

最後一章有點雜亂﹐講下第一代全球化即舊殖民時代的全球經濟﹐第一代全球化直到第一次世界大戰才結束。。接下來講下經濟殺手又講下索羅斯﹐不過我讀看經濟殺手的原著﹐這一節的內容沒有新意。當然不能不提諾貝爾經濟獎得主的LTCM基金﹐以為他發明的數學可以預測一切﹐卻計算漏了自身的行為會影響市場﹐結果鑲成八九年的金融風暴。最後一節講下現在全球經濟﹐中美兩大經濟巨頭的較量﹐這部文章內容水分大多﹐內容與平時報章看到的大同小異。

最後全書總結金融體系的發展歷史﹐並指出雖有經濟系統幾百年的經歷不斷進化﹐人類並不是全然經濟理性的動物﹐很多時不能作出最合適的決定。現代經濟體系複雜無比﹐但同時亦十分脆弱﹐只要爆發全球性戰爭﹐便足以破壞幾百年的經濟進化。

Audio Technica ATH-ANC25

I have been using my old Creative noise cancellation head phone for a few years. It is starting to falling apart after all this years of good service and my abuses from 5 Indian trips. The wire connection is getting lose and sometimes the left side has no sound. It is time to get a new noise cancellation head phone for my yet another India trip.

I have been looking into buying a noise cancellation head phone for quite some time. The offering at Future Shop or Best Buy are limited. They are only selling Sony, Philips, JVC even Maxwell noise cancellation head phones. None of those brands are particularly great and they almost double the price I paid for my old Creative head phone. One day I was having lunch at Broadway and I came across into Headphone Bar, a small shop focus in selling high end head phones. It only sells brands well known among Hi-Fi fans but normally don’t available in chain electronic stores.

Headphone Bar has two new noise cancellation headphones from Audio Technica, which is a well known Japanese band, ATH-ANC27, a bigger cover the ear model and ATH-ANC25, a smaller model. The ATH-ANC27 is pretty expensive but the ATN-ANC25 is only $99, so I decide to give it a try. The moment I put it on, I already like the head phone. The ear mug is very comfortable and cancellation is good. One feature I like is the wire is detachable, so I can just wear the head phone in flight without the wire dangling over me. Since I am flying out in a few days, I don’t have time to order the head phone online or double check its review. I took my chances and bought it right on the spot.

When I got home I checked the internet to confirm my buying decision. It turns out the price I paid is the exactly list price on the web. I can find it less than $10 cheaper on eBay, so the shop does not mark up the price. Then I look at the online reviews, it turns out the ATN-ANC27 is the next generation of ATH-ANC7b and its quality almost on par with the Bose Quietcomfort 3, which is absolutely the best noise cancellation headphone. The ATN-ANC25 is the little brother of ATN-ANC27, the only difference is the padding size and the power of the sound driver. It also has very good review, it is the best noise cancellation in the sub $100 category.

I tried my new headphone on my flight from Vancouver to India. The noise cancellation is better than my old creative headphone. In the old headphone, the static pink noise was very obvious and the new headphone is much quieter. One feature I like is the wire has a volume control, so I can easily adjust the volume. The only complain is the 2-pins to 1-pin in-flight audio adapter is very flimsy. It is broken when I squeezed through the sleeping guy sitting next to me to go to the toilet. The adapter just a piece of cheaper plastic with 2 wires and I can get replacement in HK for less than $3.

Overall, I am very happy with my new noise cancellation headphone. Highly recommended for long flight, it will give you have a good night of quiet sleep.