0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
会员中心
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

chisel(一)初识

学FPGA,慢慢来 2019-08-16 16:08 次阅读
加入交流群
微信小助手二维码

扫码添加小助手

加入工程师交流群

这个夏天,一个很奇妙的机会,突然触碰到一个全新的东西,那就是Chisel。首先感谢 _iChthyosaur的博客 https://blog.csdn.net/qq_34291505/article/details/86744581给予的平台让我第一次接触到这个新鲜的东西,我决定继续开始自己的学习之旅,这个系列的博客也不会是简单的转述,还是有自己的思考,初次接触一定还是会有很多理解上的问题,希望大家共同讨论共同进步。


初次接触Chisel,自然先去了解一下这个东西是什么东西


Chisel是什么?


Chisel(读作[ˈtʃi:zɔːl]),全名ConstructingHardwarein aScalaEmbeddedLanguage,是由伯克利开发的硬件构建语言,开源。


官网:https://chisel.eecs.berkeley.edu/index.html


下面是官网上列出的一些特性:


硬件构造语言(非HLS)


嵌入在Scala编程语言中


抽象的数据类型和接口


层次化+面向对象+功能化构造


用Scala中的标记来高度参数化


多时钟域


大量的标准库,包括浮点单元


针对ASICFPGA产生低层次的Verilog代码


github开源,BSD License


什么叫硬件构建语言?是来代替Verilog/SystemVerilog的吗?


Chisel可以简单的理解成高度抽象的、高度参数化的Verilog生成器,利用Scala语言的语法糖,来快速高效的开发硬件设计。设计完成后,自动生成Verilog,再经由传统的数字IC设计方法(逻辑综合、APR)变成芯片。


我们注意几点:


Chisel是基于Scala,也可以说Chisel是用Scala语言写的针对硬件开发的库。用Chisel语言做设计就是在写Scala语言的程序。有点类似UVM是SystemVerilog语言的验证框架库。


Chisel的应用专注在前端设计,提高设计的效率。


生成的Verilog是低层次的,也就是类似门级的。


目前仍然通过DC或者Genus来综合。


与HLS有明显区别,不能直接变成工艺相关的门级电路。也许以后会增加这种功能,得看相关EDA的发展。


那Chisel相比Verilog有什么优势?


抽象程度高、高度参数化


前端设计周期缩短


可以走敏捷开发流程


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


都说Chisel开发快,那具体有哪些语法特性?


各种变量类型可以转换


位宽可以自动推断


与Verilog一样可以方便的取位和拼接


加减法可以防溢出


可以检查敏感信号列表,防止生成latch


可以以黑盒子的方式调用Verilog,或者以in-line的方式嵌入Verilog


灵活高效的接口定义,再也不需要AUTOARG


可以定义多套不同的实现,比如FPGA和ASIC定义不同的RAM


可以处理多时钟域,处理异步信号的同步


而这样介绍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是含于高级语言Scala之中,而且 Chisel实际上只是Scala中的一组特殊类定义,预定义对象和使用约定,因此当您编写Chisel时,您实际上正在编写构建硬件图的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.


对于如何使用Chisel表达


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.



在说Chisel之前首先说Scala语言,Scala是一门基于JVM运行的语言,他与JAVA语言相互兼容,Scala也是一门面向对象的函数式语言。


而现在对于主流的硬件描述语言还是Verilog,而Verilog一直以来也是有开发效率低下的弊病。后来对于这个的问题的讨论结果是对Verilog进行改良,也就出现了Verilog的后续标准——SystemVerilog,但是由于它只是用于验证。但是当时除了改良还有一部分人主张把语言转移到软件语言,(C++、Java),支持C++的诞生了SystemC,而对于Chisel就是支持Java的那部分人创造出的


是由加州大学伯克利分校的研究团队发布的一种新型硬件语言。据团队成员之一Krste Asanovic教授介绍,早在30多年前还没有硬件描述语言的时候,他们就已经开始构想这样一种语言了。最开始Chisel是基于Ruby的,但是后来发现Scala更适合构建Chisel。因为Scala有诸多特性适合描述电路,比如它是静态语言,以编译期为主,适合转换成Verilog/VHDL。再比如它的操作符即方法、柯里化、纯粹的面向对象、强大的模式匹配、便捷的泛型编写、特质混入、函数式编程等特性,使得用Scala开发DSL语言很方便。通过firrtl编译器可以把Chisel文件转换成firrtl文件,这是一种标准的中间交换格式,也就是让各种高级语言方便地转换到Verilog/VHDL的媒介,但它其实和verilog/VHDL属于同一层次。在这里,Chisel选择了妥协,没有直接生成电路,而是借助Verilog,主要是因为没有EDA工具支持,因此,它并不等同于HLS(High Level Synthesis)。将来也许会有EDA工具直接支持Chisel。


声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • Chisel
    +关注

    关注

    0

    文章

    7

    浏览量

    573
收藏 人收藏
加入交流群
微信小助手二维码

扫码添加小助手

加入工程师交流群

    评论

    相关推荐
    热点推荐

    RISC-V工具链搭建

    /riscv_install_tools/bin中产生riscv工具链和pk和spike 至此,工具链生成完成。 2.为Rocket-chip创建可以产生RTL的环境。 1)克隆和测试chisel和firrtl
    发表于 10-29 08:02

    屏掌控全场:OBOO鸥柏65寸国产飞腾D2000触摸查询体机,高效无忧

    体机
    鸥柏科技
    发布于 :2025年09月29日 18:55:01

    RT-Thread 遇上 Rust:安全内核 RusT-Thread 的诞生

    大家好,我们是中国科学技术大学操作系统原理与设计(H)课oooooS小组。这个项目是我们的课程大作业:参考RT-Thread架构,使用Rust搭建个原生的嵌入式操作系统内核。初识Rust是因为xk
    的头像 发表于 08-02 11:03 3206次阅读
    RT-Thread 遇上 Rust:安全内核 RusT-Thread 的诞生

    初识瑞萨FSP固件库

    FSP全称为“Flexible Software Package”,中文译为“灵活配置软件包”。
    的头像 发表于 07-19 09:21 2037次阅读
    <b class='flag-5'>一</b>文<b class='flag-5'>初识</b>瑞萨FSP固件库

    【Milk-V Duo S 开发板免费体验】Milk-V Duo S 开发板试用报告(1)开箱

    初识 盼啊盼,终于盼来了这块Milk-V Duo S。先看下Duo S的包装。(图1) 图1 可以看到,外圈有层塑料外壳,并且材质很好,摸起来很顺滑。而用普通Milk-V
    发表于 06-29 19:43

    零死角玩转STM32——初级篇

    ,从裸奔到系统,让您零死角玩转 STM32。 目录内容: 1、如何编译和下载程序 2、JLINK 驱动安装与 MDK 环境搭建 3、如何新建工程模板 4、初识 STM32 库 5、流水
    发表于 05-21 13:48

    【米尔-全志T536开发板试用体验】 试用测评报-初识T536

    【米尔-全志T536开发板试用体验】 试用测评报-初识T536 从电子发烧友网申请到MYC-LT536核心板及开发板有段时间了,因为工作中有用到全志V536开发方案,仔细的对比了这个新出的开发板
    发表于 04-23 11:35

    21.5寸触摸体机:便捷互动的新窗口

    体机
    朗锐智科
    发布于 :2025年04月10日 15:34:00

    【「芯片通识课:本书读懂芯片技术」阅读体验】初识芯片样貌

    ) 微控制器(MCU)是小型电子产品和电子系统的控制中心。MCU按照内部程序的存储形式可分为以下三种类型:掩膜型(Mask)MCU在出厂时,程序已固化在芯片内部,程序功能不可变化;次性编程型(OTP)MCU
    发表于 03-23 09:47

    汽车电路初识

    章 汽车电路分析基础第二章 汽车电路图识读第三章 典型汽车电器电路分析第四章 汽车电路检修第五章 汽车电子电路图识读
    发表于 03-10 18:04 7次下载

    零基础开发小安派-Eyes-S1【进阶篇】——初识 LVGL 并搭建最小工程

    AiPi-Eyes-S1 是安信可开源团队专门为Ai-M61-32S设计的款开发板,支持WiFi6、BLE5.3。所搭载的Ai-M61-32S 模组具有丰富的外设接口,具体包括 DVP、MJPEG
    的头像 发表于 01-06 16:14 1322次阅读
    零基础开发小安派-Eyes-S1【进阶篇】——<b class='flag-5'>初识</b> LVGL 并搭建最小工程

    零基础开发小安派-Eyes-S1——初识LVGL并搭建最小工程

    AiPi-Eyes-S1 是安信可开源团队专门为Ai-M61-32S设计的款开发板,支持WiFi6、BLE5.3。所搭载的Ai-M61-32S 模组具有丰富的外设接口,具体包括 DVP、MJPEG
    的头像 发表于 01-03 14:09 1337次阅读

    初识光模块之光模块的分类

    高速先生成员--周伟 说到光模块,很多用过光模块的人肯定很清楚光模块有很多种,但还有很多人只是见过或者知道有光模块,但光模块具体怎么分类的,我相信很多人都和我们开始接触光模块样都是知半解,甚至
    发表于 12-10 08:59

    初识光模块之光模块的分类

    高速先生成员--周伟 说到光模块,很多用过光模块的人肯定很清楚光模块有很多种,但还有很多人只是见过或者知道有光模块,但光模块具体怎么分类的,我相信很多人都和我们开始接触光模块样都是知半解,甚至
    的头像 发表于 12-10 08:58 1608次阅读
    <b class='flag-5'>初识</b>光模块之光模块的分类