https://github.com/sylefeb/Silice Skip to content Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Project management - + Integrations - + GitHub Sponsors - + Customer stories- * Team * Enterprise * Explore + Explore GitHub - Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Education - [ ] [search-key] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} sylefeb / Silice * Notifications * Star 693 * Fork 44 Silice is an open source language that simplifies prototyping and writing algorithms on FPGA architectures. AGPL-3.0 License 693 stars 44 forks Star Notifications * Code * Issues 62 * Pull requests 1 * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags 3 branches 0 tags Code Clone HTTPS GitHub CLI [https://github.com/s] Use Git or checkout with SVN using the web URL. [gh repo clone sylefe] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching Xcode If nothing happens, download Xcode and try again. Go back Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @sylefeb sylefeb clarification in documentation ... 420e559 Jun 21, 2021 clarification in documentation 420e559 Git stats * 1,469 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time antlr adding 'file("filename")' in table initializations Apr 20, 2021 bin silice-make.py: add reprogram arg Nov 13, 2020 docs/figures documentation wip Apr 16, 2021 frameworks terrain, cleanup, comments Apr 27, 2021 learn-silice clarification in documentation Jun 21, 2021 lib initial commit Oct 7, 2019 projects Merge pull request #148 from rob-ng15/draft Jun 20, 2021 src wip Apr 25, 2021 tests wip on intro tutorial Apr 21, 2021 tools stl2raw, wip Apr 10, 2021 .gitattributes git attributes Dec 30, 2020 .gitignore minor fix ulx3s framework Oct 3, 2020 .gitmodules doomchip, testing May 22, 2020 CMakeLists.txt Merge branch 'wip' into osnr-mac Nov 11, 2020 GetStarted.md updating link to fpga-binutils Apr 20, 2021 GetStarted_Linux.md simplified verilator compilation process, attempt at fixing #12 ... Apr 22, 2021 GetStarted_Windows.md minor tweaks Apr 22, 2021 GetStarted_macOS.md simplified verilator compilation process, attempt at fixing #12 ... Apr 22, 2021 LICENSE doomchip, testing May 22, 2020 README.md pass on README Jun 6, 2021 compile_silice_linux.sh blinky readme comments Feb 25, 2021 compile_silice_mingw64.sh minor tweaks Apr 22, 2021 compile_silicehe_linux.sh linux compilation fixes Jun 22, 2020 compile_silicehe_mingw64.sh started to revise READMEs, doomchip upgrade, new Makefiles, ulx3s syn... Oct 4, 2020 get_started_mingw64.sh minor tweaks Apr 22, 2021 install_dependencies_linux.sh refreshed install instructions, split linux install scripts in depend... Feb 24, 2021 View code Silice What is Silice? Design principles and features A first example: Code: Compile: Enjoy! Explanations: Cycles and control flow: Code: Explanations: Other examples with detailed explanations Getting started with Silice Project status: Alpha release Development branches Directory structure README.md Silice A language for hardcoding Algorithms into FPGA hardware --------------------------------------------------------------------- Quick links: * To setup Silice, see the getting started guide. * To start designing hardware, see learn Silice. * To see what can be done with Silice, checkout the example projects (all are available in this repo). * Watch the introduction video on programming FPGAs with Silice (youtube). * Browse through the reference documentation. * Feel free to ask questions about the language syntax in this github issue. * Refer to the optimization guidelines for fine tuning your Silice designs. * Read how to add a new board in the Silice build system. Important: Silice is in alpha stages and under active development read more. Important: Latest changes occur in the wip (work in progress) and draft branches, check it out to enjoy the latest features. Read more about development branches. --------------------------------------------------------------------- What is Silice? Silice simplifies prototyping algorithms on FPGAs. It provides a comfortable yet thin abstraction above Verilog (a typical hardware description language), simplifying design without loosing precise control over the hardware. It provides "quality of life" features to group signals, define generic interfaces and circuitries, instantiate block RAMs, describe pipelines, deal with multiple clock domains and automatically manage flip-flops. It gives the (optional) ability to write parts of your design as sequences of operations, subroutines that can be called, and to use control flow statements such as while and break, describing operations and algorithms that run in parallel and are precisely in sync. Silice detects combinatorial loops and many other error-prone cases, and features a Lua-preprocessor enabling advanced code generation. Silice does not aim to be a high level synthesis language: it remains close to the hardware and lets you fully exploit FPGA architectures, with a fine grain control on how your design maps to the hardware: You remain in control of what happens at each and every clock cycle, with predictable rules for flow control, how and when execution states appear, how flip-flops map to variables, and what gets registered or not. In fact, if you chose so you can design in a way that is very similar to Verilog, while still benefiting from the "quality of life" improvements of Silice syntax. This allows to refine an initial prototype from concept to efficient implementation. Silice compiles to and inter-operates with Verilog: you can directly instantiate and bind with existing modules. The language comes with a complete build system, many examples and basic components (VGA, HDMI, OLED, UART, and SDRAM controllers). The build system allows to get started easily, and already supports many popular boards such as the IceBreaker, ULX3S, Fomu and IceStick. You do not need an FPGA to start with Silice: designs and their outputs (e.g. VGA signal) can be simulated and visualized. Silice works great with the open source FGPA toolchain (yosys/nextpnr/ icestorm), see our Ice40 and ECP5 examples. While I developed Silice for my own needs, I hope you'll find it useful for your projects! Design principles and features Silice does not abstract away the hardware: the programmer remains in control and very close to hardware features. It provides syntactic helpers simplifying design and reuse (signal groups, generic interfaces, pipelining). Silice can also help you reason in terms of execution flow and operation sequences. However, this is not mandatory and you can also take full control and use a more direct hardware design style. When developing with Silice you can focus optimization efforts on critical parts, and use a simpler approach in other parts of the design. The main features are: * A clean, simple syntax that clearly exposes the flow of operations and where clock cycles are spent. * Precise rules regarding flow control (loops, calls) and their clock cycle consumption. * Familiar hardware constructs such as always blocks, instantiation, expression tracking (wires). * An optional flow-control oriented design style (automatic FSM generation), that naturally integrates within a design: while, break, subroutines. * The possibility to easily describe pipelines. * Automatically takes care of creating flip-flops for variables, with automatic pruning (e.g. const or bindings). * Generic interfaces and grouped IOs for easy reuse and modular designs. * Generic circuitries that can be instantiated and reused easily. * Explicit clock domains and reset signals. * Familiar syntax with both C and Verilog inspired elements. * Inter-operates with Verilog, allowing to import and reuse existing modules. * Powerful LUA-based pre-processor. These examples are different and representative of this approach: * The voxel space terrain is relying on Silice sequential flow syntax. * The fire-v project is a graphical RISCV framework with a RV32I processor that relies mostly on non-sequential constructs. * The SDRAM controllers use a mixed style. * The pipeline sort is an example of using the pipeline syntax ( experimental, may change). A first example: (see also the full blinky tutorial) Code: 1 algorithm main(output uint8 led) { 2 uint28 counter = 0; // a 28 bits unsigned integer 3 led := counter[20,8]; // LEDs updated every clock with the 8 most significant bits 4 while (1) { // forever 5 counter = counter + 1; // increment counter 6 } 7 } Compile: cd projects cd blinky make mojov3 Enjoy! First example in action on a Mojo v3 Explanations: Line 1 is the entry point of any Silice hardware: the main algorithm. Line 2 we define a 28 bits unsigned int, initialized to 0. Initializers are mandatory and are always constants. Line 3 we request that the output led tracks the eight most significant bits of the counter variable. The syntax [20,8] means 8 bits wide starting from bit 20. The assignment to led uses the := operator which is an always assignment: led is now automatically updated with counter after each rising clock. Such assignments have to appear at the top of an algorithm, right before any other instruction. Finally, lines 4-6 define the infinite loop that increments the counter. Of course the 28 bit counter will ultimately overflow and go back to 0, hence the cyclic LED light pattern. In this case, the loop takes exactly one cycle to execute: we have one increment per cycle at 50 MHz (the clock frequency of the Mojo v3). We then compile with silice. The -f parameter indicates which framework to use: this is an FPGA plateform dependent wrapper code. Here we are using the Mojo framework with LEDs only. Several other frameworks are provided, and it is easy to write your own. The -o parameter indicates where to write the Verilog output. In this example we overwrite the main file of a pre-existing project, which is then compiled using Xilinx ISE toolchain. Fear not, we also have examples working with yosys, nextpnr and project icestorm! Cycles and control flow: Here is another small example outlining a core principle of Silice: Code: 1 algorithm main() { 2 brom int12 sintbl[4096] = {...} 3 ... 4 while (1) { // render loop 5 // get cos/sin view 6 sintbl.addr = (viewangle) & 4095; 7 ++: 8 sinview = sintbl.rdata; 9 sintbl.addr = (viewangle + 1024) & 4095; 10 ++: 11 cosview = sintbl.rdata; 12 ... Explanations: This code is storing a sine table in a block ROM and accesses it to obtain a cosine and sine for the current view angle. Note the use of the ++: step operator in lines 7 and 10. This explicitely splits the exectution flow and introduces a one cycle delay, here waiting for the brom to output its result in field rdata for the select address in addr. Anything in between is considered combinational; for instance lines 8 and 9 are evaluated in parallel on hardware, as they each produce two pieces of independent circuitry. Other examples with detailed explanations This repo contains many example projects, some including detailed code walkthrough: * HDMI test framework * streaming audio from sdcard * Pipelined sort Getting started with Silice See the getting started guide. Silice runs great on Windows, Linux, and macOS! To start writing code, see writing your first design. To see what can be done with Silice, checkout our example projects (all are available in this repo). Project status: Alpha release Silice can already be used to create non trivial designs, from a tiny Risc-V processor to an entire game render loop (visit the examples page). However Silice is under active development. I decided to open the repo so everyone can join in the fun, but it is far from complete: documentation is lacking, some examples are outdated or far from polished, some very important language features are missing, and many known issues exist (head out to the Issues page). I am confident I can avoid major code breaking syntax changes, but some adjustments may be necessary. I hope you'll nevertheless enjoy diving into it, and will find it useful. Please let me know your thoughts: comments and contributions are welcome! Development branches * master is the latest, most stable version * wip is where new features are being implemented, less stable but reasonnable * draft is heavy experimental work in progress, likely unstable, may not compile Directory structure * learn-silice contains documentation and tutorials * projects contains many demo projects (see README therein) as well as build scripts for several boards * bin contains the Silice binaries after compiling using the compile_silice_*.sh script * frameworks contains the frameworks for various boards and setups * tools contains tools useful for Silice development, either source or binary form (to be installed, see getting started) * src contains Silice core source code * antlr contains Silice grammar and parsing related source code * tests contains test scripts for Silice development About Silice is an open source language that simplifies prototyping and writing algorithms on FPGA architectures. Topics language programming fpga Resources Readme License AGPL-3.0 License Releases No releases published Packages 0 No packages published Contributors 6 * @sylefeb * @trabucayre * @rob-ng15 * @osnr * @ThibaultTricard * @diadatp Languages * C++ 43.1% * C 27.0% * Slice 12.4% * HTML 6.7% * Verilog 6.6% * Lua 1.4% * Other 2.8% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.