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

    浏览量

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

扫码添加小助手

加入工程师交流群

    评论

    相关推荐
    热点推荐

    Java并发编程的“基石”——多线程概念初识

    之下,隐藏着个庞大而复杂的“算力帝国”。如何将成千上万块 GPU 的算力精准、高效地分配给无数个并发的 AI 任务?这便是 AI 算力调度的核心使命。在这个看似属于 Python 和 C++ 的绝对
    发表于 04-16 18:50

    触拓(CHUTO)32 寸立式点餐机,大屏触控点餐快人步#触拓 # 自助体机 #点餐机

    体机
    深圳市触拓科技有限公司
    发布于 :2026年04月08日 12:23:06

    触拓(CHUTO)户外广告体机,无惧酷暑全天候在线# 触拓 #户外触摸体机

    体机
    深圳市触拓科技有限公司
    发布于 :2026年04月08日 12:20:40

    【FH8626V300L试用】+初识

    富瀚微FH8626V300L是款面向智慧视觉处理的评估板,感谢组织者和厂家能为大家提供这次体验的好机会。厂家的产品的形象设计十分重视,整个产品被放置在个塑料盒子内,见图1所示。 图1 包装
    发表于 03-27 18:24

    初识马达基本原理及组成部分

    。当电流通过线圈时,会产生磁场;磁场与另个固定磁场(由永磁体或电磁铁产生)相互作用,产生转矩,驱动转子旋转。例如,直流马达通过电刷和换向器改变电流方向,使转子持续旋转;交流马达则利用定子绕组产生的旋转磁场带动转
    的头像 发表于 01-05 09:32 935次阅读
    <b class='flag-5'>初识</b>马达基本原理及组成部分

    【瑞萨RA6E2地奇星开发板试用】初识开发板+环境配置

    初识RA6E2: 开发板资料从哪来: 【立创·地奇星RA6E2】开发板 文档中心 https://wiki.lckfb.com/zh-hans/a6e2/ 资料下载,RA生态工作室 gitee
    发表于 12-10 00:20

    LuatOS下GNSS定位开发实战:初识定位、NMEA解码与位置追踪上报

    在LuatOS环境中进行GNSS定位开发,是许多物联网项目的基础需求。本指南旨在提供份实战向导,带您经历从GNSS定位的初始化设置,到对NMEA标准数据的解码解析,再到将追踪到的实时位置数据上报
    的头像 发表于 10-29 16:03 459次阅读
    LuatOS下GNSS定位开发实战:<b class='flag-5'>初识</b>定位、NMEA解码与位置追踪上报

    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 3717次阅读
    RT-Thread 遇上 Rust:安全内核 RusT-Thread 的诞生

    初识瑞萨FSP固件库

    FSP全称为“Flexible Software Package”,中文译为“灵活配置软件包”。
    的头像 发表于 07-19 09:21 2778次阅读
    <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