0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

chisel(一)初識(shí)

學(xué)FPGA,慢慢來(lái) ? 2019-08-16 16:08 ? 次閱讀

這個(gè)夏天,一個(gè)很奇妙的機(jī)會(huì),突然觸碰到一個(gè)全新的東西,那就是Chisel。首先感謝 _iChthyosaur的博客 https://blog.csdn.net/qq_34291505/article/details/86744581給予的平臺(tái)讓我第一次接觸到這個(gè)新鮮的東西,我決定繼續(xù)開(kāi)始自己的學(xué)習(xí)之旅,這個(gè)系列的博客也不會(huì)是簡(jiǎn)單的轉(zhuǎn)述,還是有自己的思考,初次接觸一定還是會(huì)有很多理解上的問(wèn)題,希望大家共同討論共同進(jìn)步。


初次接觸Chisel,自然先去了解一下這個(gè)東西是什么東西


Chisel是什么?


Chisel(讀作[?t?i:z??l]),全名ConstructingHardwarein aScalaEmbeddedLanguage,是由伯克利開(kāi)發(fā)的硬件構(gòu)建語(yǔ)言,開(kāi)源。


官網(wǎng):https://chisel.eecs.berkeley.edu/index.html


下面是官網(wǎng)上列出的一些特性:


硬件構(gòu)造語(yǔ)言(非HLS)


嵌入在Scala編程語(yǔ)言中


抽象的數(shù)據(jù)類型和接口


層次化+面向?qū)ο?功能化構(gòu)造


用Scala中的標(biāo)記來(lái)高度參數(shù)


多時(shí)鐘域


大量的標(biāo)準(zhǔn)庫(kù),包括浮點(diǎn)單元


針對(duì)ASICFPGA產(chǎn)生低層次的Verilog代碼


github開(kāi)源,BSD License


什么叫硬件構(gòu)建語(yǔ)言?是來(lái)代替Verilog/SystemVerilog的嗎?


Chisel可以簡(jiǎn)單的理解成高度抽象的、高度參數(shù)化的Verilog生成器,利用Scala語(yǔ)言的語(yǔ)法糖,來(lái)快速高效的開(kāi)發(fā)硬件設(shè)計(jì)。設(shè)計(jì)完成后,自動(dòng)生成Verilog,再經(jīng)由傳統(tǒng)的數(shù)字IC設(shè)計(jì)方法(邏輯綜合、APR)變成芯片。


我們注意幾點(diǎn):


Chisel是基于Scala,也可以說(shuō)Chisel是用Scala語(yǔ)言寫的針對(duì)硬件開(kāi)發(fā)的庫(kù)。用Chisel語(yǔ)言做設(shè)計(jì)就是在寫Scala語(yǔ)言的程序。有點(diǎn)類似UVM是SystemVerilog語(yǔ)言的驗(yàn)證框架庫(kù)。


Chisel的應(yīng)用專注在前端設(shè)計(jì),提高設(shè)計(jì)的效率。


生成的Verilog是低層次的,也就是類似門級(jí)的。


目前仍然通過(guò)DC或者Genus來(lái)綜合。


與HLS有明顯區(qū)別,不能直接變成工藝相關(guān)的門級(jí)電路。也許以后會(huì)增加這種功能,得看相關(guān)EDA的發(fā)展。


那Chisel相比Verilog有什么優(yōu)勢(shì)?


抽象程度高、高度參數(shù)化


前端設(shè)計(jì)周期縮短


可以走敏捷開(kāi)發(fā)流程


除了可以生成Verilog,還可以生成C/CPP。


都說(shuō)Chisel開(kāi)發(fā)快,那具體有哪些語(yǔ)法特性?


各種變量類型可以轉(zhuǎn)換


位寬可以自動(dòng)推斷


與Verilog一樣可以方便的取位和拼接


加減法可以防溢出


可以檢查敏感信號(hào)列表,防止生成latch


可以以黑盒子的方式調(diào)用Verilog,或者以in-line的方式嵌入Verilog


靈活高效的接口定義,再也不需要AUTOARG


可以定義多套不同的實(shí)現(xiàn),比如FPGA和ASIC定義不同的RAM


可以處理多時(shí)鐘域,處理異步信號(hào)的同步


而這樣介紹Chisel:


Chisel (Constructing Hardware In a Scala Embedded Language) is a hardware construction language embedded in the high-level programming language Scala. At some point we will provide a proper reference manual, in addition to more tutorial examples. In the meantime, this document along with a lot of trial and error should set you on your way to using Chisel. Chisel is really only a set of special class definitions, predefined objects, and usage conventions within Scala, so when you write Chisel you are actually writing a Scala program that constructs a hardware graph. However, for the tutorial we don't presume that you understand how to program in Scala. We will point out necessary Scala features through the Chisel examples we give, and significant hardware designs can be completed using only the material contained herein. But as you gain experience and want to make your code simpler or more reusable, you will find it important to leverage the underlying power of the Scala language. We recommend you consult one of the excellent Scala books to become more expert in Scala programming.


首先Chisel是含于高級(jí)語(yǔ)言Scala之中,而且 Chisel實(shí)際上只是Scala中的一組特殊類定義,預(yù)定義對(duì)象和使用約定,因此當(dāng)您編寫Chisel時(shí),您實(shí)際上正在編寫構(gòu)建硬件圖的Scala程序


Through the tutorial, we format commentary on our design choices as in this paragraph. You should be able to skip the commentary sections and still fully understand how to use Chisel, but we hope you'll find them interesting.


We were motivated to develop a new hardware language by years of struggle with existing hardware description languages in our research projects and hardware design courses. Verilog and VHDL were developed as hardware simulation languages, and only later did they become a basis for hardware synthesis. Much of the semantics of these languages are not appropriate for hardware synthesis and, in fact, many constructs are simply not synthesizable. Other constructs are non-intuitive in how they map to hardware implementations, or their use can accidently lead to highly inefficient hardware structures. While it is possible to use a subset of these languages and still get acceptable results, they nonetheless present a cluttered and confusing specification model, particularly in an instructional setting.


However, our strongest motivation for developing a new hardware language is our desire to change the way that electronic system design takes place. We believe that it is important to not only teach students how to design circuits, but also to teach them how to design circuit generators ---programs that automatically generate designs from a high-level set of design parameters and constraints. Through circuit generators, we hope to leverage the hard work of design experts and raise the level of design abstraction for everyone. To express flexible and scalable circuit construction, circuit generators must employ sophisticated programming techniques to make decisions concerning how to best customize their output circuits according to high-level parameter values and constraints. While Verilog and VHDL include some primitive constructs for programmatic circuit generation, they lack the powerful facilities present in modern programming languages, such as object-oriented programming, type inference, support for functional programming, and reflection.


Instead of building a new hardware design language from scratch, we chose to embed hardware construction primitives within an existing language. We picked Scala not only because it includes the programming features we feel are important for building circuit generators, but because it was specifically developed as a base for domain-specific languages.


對(duì)于如何使用Chisel表達(dá)


While Chisel focuses on binary logic, Chisel can support analog and tri-state wires with the Analog type - see Datatypes in Chisel.


We focus on binary logic designs as they constitute the vast majority of designs in practice. Tri-state logic are poorly supported standard industry flows and require special/controlled hard macros in order to be done.



在說(shuō)Chisel之前首先說(shuō)Scala語(yǔ)言,Scala是一門基于JVM運(yùn)行的語(yǔ)言,他與JAVA語(yǔ)言相互兼容,Scala也是一門面向?qū)ο蟮暮瘮?shù)式語(yǔ)言。


而現(xiàn)在對(duì)于主流的硬件描述語(yǔ)言還是Verilog,而Verilog一直以來(lái)也是有開(kāi)發(fā)效率低下的弊病。后來(lái)對(duì)于這個(gè)的問(wèn)題的討論結(jié)果是對(duì)Verilog進(jìn)行改良,也就出現(xiàn)了Verilog的后續(xù)標(biāo)準(zhǔn)——SystemVerilog,但是由于它只是用于驗(yàn)證。但是當(dāng)時(shí)除了改良還有一部分人主張把語(yǔ)言轉(zhuǎn)移到軟件語(yǔ)言,(C++、Java),支持C++的誕生了SystemC,而對(duì)于Chisel就是支持Java的那部分人創(chuàng)造出的


是由加州大學(xué)伯克利分校的研究團(tuán)隊(duì)發(fā)布的一種新型硬件語(yǔ)言。據(jù)團(tuán)隊(duì)成員之一Krste Asanovic教授介紹,早在30多年前還沒(méi)有硬件描述語(yǔ)言的時(shí)候,他們就已經(jīng)開(kāi)始構(gòu)想這樣一種語(yǔ)言了。最開(kāi)始Chisel是基于Ruby的,但是后來(lái)發(fā)現(xiàn)Scala更適合構(gòu)建Chisel。因?yàn)镾cala有諸多特性適合描述電路,比如它是靜態(tài)語(yǔ)言,以編譯期為主,適合轉(zhuǎn)換成Verilog/VHDL。再比如它的操作符即方法、柯里化、純粹的面向?qū)ο?、?qiáng)大的模式匹配、便捷的泛型編寫、特質(zhì)混入、函數(shù)式編程等特性,使得用Scala開(kāi)發(fā)DSL語(yǔ)言很方便。通過(guò)firrtl編譯器可以把Chisel文件轉(zhuǎn)換成firrtl文件,這是一種標(biāo)準(zhǔn)的中間交換格式,也就是讓各種高級(jí)語(yǔ)言方便地轉(zhuǎn)換到Verilog/VHDL的媒介,但它其實(shí)和verilog/VHDL屬于同一層次。在這里,Chisel選擇了妥協(xié),沒(méi)有直接生成電路,而是借助Verilog,主要是因?yàn)闆](méi)有EDA工具支持,因此,它并不等同于HLS(High Level Synthesis)。將來(lái)也許會(huì)有EDA工具直接支持Chisel。


聲明:本文內(nèi)容及配圖由入駐作者撰寫或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場(chǎng)。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問(wèn)題,請(qǐng)聯(lián)系本站處理。 舉報(bào)投訴
  • Chisel
    +關(guān)注

    關(guān)注

    0

    文章

    7

    瀏覽量

    446
收藏 人收藏

    評(píng)論

    相關(guān)推薦

    思道SEEKVIEU體機(jī)電腦

    體機(jī)
    jf_69621499
    發(fā)布于 :2024年09月03日 08:50:17

    【《軟件開(kāi)發(fā)珠璣》閱讀體驗(yàn)】+ 初識(shí)

    著為自己摘下“只會(huì)寫代碼”的標(biāo)簽了。相信在未來(lái)的職業(yè)生涯中,這本書給我?guī)?lái)的知識(shí)能讓我在各個(gè)地方發(fā)光發(fā)熱,在某種意義上可以幫我突破些瓶頸。 同樣,我期望這本書也能在正在閱讀此書的你未來(lái)的職業(yè)生涯中
    發(fā)表于 06-21 16:33

    集特體機(jī)

    顯卡體機(jī)
    jf_67464575
    發(fā)布于 :2024年05月22日 09:05:55

    大語(yǔ)言模型:原理與工程實(shí)踐+初識(shí)2

    系列變革。 大語(yǔ)言模型是深度學(xué)習(xí)的應(yīng)用之,可以認(rèn)為,這些模型的目標(biāo)是模擬人類交流,為了理解和生成人類語(yǔ)言。為此,模型需要在大量文本數(shù)據(jù)上訓(xùn)練,用來(lái)理解人類語(yǔ)言,進(jìn)而,實(shí)現(xiàn)與人類的無(wú)障礙對(duì)話交流
    發(fā)表于 05-13 00:09

    大語(yǔ)言模型:原理與工程時(shí)間+小白初識(shí)大語(yǔ)言模型

    開(kāi)拓深度學(xué)習(xí)的思路。對(duì)于新涌現(xiàn)的大語(yǔ)言模型的能力,主要是表現(xiàn)在學(xué)習(xí)能力的提升、語(yǔ)言理解和生成能力、創(chuàng)新和探索的能力。 基礎(chǔ)技術(shù) 詞表示技術(shù) 詞表示般分為三種,主要是詞的獨(dú)熱表示(One-hot),詞
    發(fā)表于 05-12 23:57

    初識(shí)FPGA需要關(guān)注的注意事項(xiàng)!

    1.基礎(chǔ)問(wèn)題 FPGA的基礎(chǔ)就是數(shù)字電路和HDL語(yǔ)言,想學(xué)好FPGA的人,建議床頭都有本數(shù)字電路的書,不管是哪個(gè)版本的,這個(gè)是基礎(chǔ),多了解也有助于形成硬件設(shè)計(jì)的思想。在語(yǔ)言方面,建議初學(xué)者學(xué)習(xí)
    發(fā)表于 02-22 10:57

    #2024,立Flag了嘛? # 開(kāi)年之疑問(wèn)重重

    選擇SpinalHDL、chisel還是verilog HDL作為開(kāi)發(fā)語(yǔ)言,上周FPGA大佬跟幾個(gè)在IC設(shè)計(jì)公司的同學(xué)吃飯后,聊了下發(fā)現(xiàn)對(duì)應(yīng)的行業(yè)標(biāo)桿的公司導(dǎo)入了spinalHDL作為開(kāi)發(fā)語(yǔ)言
    發(fā)表于 01-13 09:18

    人臉考勤打卡體機(jī)

    體機(jī)
    jf_66410442
    發(fā)布于 :2024年01月09日 11:09:22

    《深入理解FFmpeg閱讀體驗(yàn)》初識(shí)有感

    恰好有這么好的機(jī)會(huì),當(dāng)然也有緣份讓我有幸成為試讀者,特此感謝電子發(fā)燒友論壇。 【初識(shí)有感】 我今天剛拿到的書,認(rèn)真的閱讀了推薦語(yǔ)、序、前言這幾篇,讓我深有感觸。 第,通過(guò)這幾篇我得知?jiǎng)⑵缋蠋?,?b class='flag-5'>一
    發(fā)表于 01-07 19:48

    Elfboard\"自創(chuàng)派\" 共創(chuàng)社活動(dòng) --- Elfboard開(kāi)發(fā)板初識(shí)1.0

    以下文章來(lái)源于嵌入式AI雜談 ,作者努力的佬瑞 本篇文章來(lái)源于ElfBoard的首批共創(chuàng)官oo,感謝分享! ElfBoard精心構(gòu)筑的嵌入式技術(shù)應(yīng)用社群“自創(chuàng)派”共創(chuàng)社,已成立了半月有余。在這
    發(fā)表于 01-04 10:25

    學(xué)習(xí)筆記分享|ElfBoard開(kāi)發(fā)板初識(shí)

    以下文章來(lái)源于嵌入式AI雜談 ,作者努力的佬瑞 本篇文章來(lái)源于ElfBoard的首批共創(chuàng)官oo,感謝分享! ElfBoard精心構(gòu)筑的嵌入式技術(shù)應(yīng)用社群“自創(chuàng)派”共創(chuàng)社,已成立了半月有余。在這
    發(fā)表于 01-04 10:22

    初識(shí)電阻與電阻器

    初識(shí)電阻與電阻器
    的頭像 發(fā)表于 12-08 17:24 ?535次閱讀
    <b class='flag-5'>初識(shí)</b>電阻與電阻器

    【飛騰派4G版免費(fèi)試用】初識(shí)

    飛騰派開(kāi)發(fā)板是螢火工場(chǎng)研發(fā)的款面向行業(yè)工程師、學(xué)生和愛(ài)好者的開(kāi)源硬件,它采用飛騰定制的四核處理器,該處理器兼容 ARM V8 指令集,并含有 2 個(gè) FTC664核和 2 個(gè) FTC310 核
    發(fā)表于 12-07 11:26

    什么是DDS?初識(shí)CP AUTOSAR平臺(tái)下的DDS規(guī)范

    數(shù)據(jù)分發(fā)服務(wù)(DDS)[1]是個(gè)來(lái)自對(duì)象管理組(OMG)的中間件協(xié)議和API標(biāo)準(zhǔn)。它將系統(tǒng)的組件集成在起,提供低延遲的數(shù)據(jù)連接,極高的可靠性,和可擴(kuò)展的架構(gòu)。
    的頭像 發(fā)表于 12-05 18:18 ?3090次閱讀
    什么是DDS?<b class='flag-5'>初識(shí)</b>CP AUTOSAR平臺(tái)下的DDS規(guī)范

    collections:款強(qiáng)大的內(nèi)置容器

    01 初識(shí)collections Collections模塊是python的內(nèi)置模塊之,提供了很多容器類型。按照官方文檔介紹,它被用作是對(duì)python通用內(nèi)置類型(list、dict、set
    的頭像 發(fā)表于 11-01 11:38 ?6520次閱讀
    collections:<b class='flag-5'>一</b>款強(qiáng)大的內(nèi)置容器