Git Product home page Git Product logo

sylefeb / silice Goto Github PK

View Code? Open in Web Editor NEW
1.2K 1.2K 76.0 52.91 MB

Silice is an easy-to-learn, powerful hardware description language, that simplifies designing hardware algorithms with parallelism and pipelines.

License: Other

CMake 1.10% Batchfile 0.05% Shell 1.33% C++ 52.08% Makefile 0.70% ANTLR 0.42% Roff 0.11% Verilog 9.16% HTML 7.26% CSS 0.16% C 24.08% Lua 1.71% PostScript 0.10% Tcl 0.34% Assembly 0.32% Python 1.02% Emacs Lisp 0.07% Pike 0.01% M4 0.01%
fpga language programming

silice's People

Contributors

aaronferrucci avatar actions-user avatar cbalint13 avatar conversy avatar diadatp avatar emard avatar goran-mahovlic avatar mesabloo avatar osnr avatar rob-ng15 avatar sylefeb avatar tommythorn avatar torkos avatar trabucayre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

silice's Issues

Expression binding <:: and output! can be misleading

Expression tracking may use the 'value at previous clock' assignment (::=). However, in some cases (tracking another tracker, or value bound to instance output) this does nothing as there is no flip-flop associated. In such a case ::= is the same as :=.

This should issue an error. The docummentation should explain and provide a solution on how to achieve the desired effect (i.e. adding an intermediate flip-flop).

Verilator vga framework seems unstable

While it mostly works, there seems to be an instability in the verilator vga framework making it randomly crash in some cases. Could be uninitialized vars or out of bound access. To investigate and fix.

Dual block rams

We now have brams:
bram uint8 tbl[1024];

We also need dual clock block RAMs. Potential syntax:
dualbram uint8 tbl<@rclock1,@wclock2>[1024];

Bitfields cannot be easily set from expressions

Bitfields can be used as initializers, but not in expressions. Should be easy enough as they translate to concatenations. Also, it seems assigning through a bitfield leads to an internal error.

Provide combinational depth insights

Related to but different from #5

It would be useful for the compiler to report a notion of computational depth, that is the longest combinational chain through dependencies (including through instances).

While this is far from actual hardware, it would give insights regarding the data paths and help visualize the flow of data and data overly long chains.

This relates to #5, since detecting combinational loops likely requires explicitly building the dependency chains.

Don't install from package management if software/tool exists already

This tool looks really great!

A slight inconvenience during installation:
When running compile_silice_linux.sh, the installation of e.g. Verilator, yosys etc. is hardcoded and therefore always run.
The repo version of e.g. Verilator in my repo (Linux Mint) is quite old (3.916) but I have a more current version installed. It would be better if the script only installs these tools if the tool exists.
I have no idea how to achieve that and am aware that checking and comparing the version of each tool is a challenge in itself and not the scope of an Algorithm-to-Verilog converter.

outputs init value

Algorithm outputs take a value of 0 at startup. However, it might be desirable to set this default to something else. This also may be confusing when a variable with initial value is bound to the output. Clarify this behavior and implement an initial value.

Shall we add the possibility to name parameters in calls?

Currently, upon calling an algorithm/subroutine/circuit the parameters are passed in order of input and received in order of outputs.
This can quickly be dangerous. We could (optionally or enforce) naming upon calls.

Instead of
(a,b) <- foo <- (c,d)
We'd have
(a=computed_value) <- foo <- (param_x=c,param_y=d)
With
suboutine foo(input uint8 param_x,input uint8 param_y,output uint8 computed_value) {}

Code refactor

The Algorithm class has grown way too large. It consists of three main parts: gather / optimize / writer. These should be split in three classes interacting through a common datastructure with, possibly, a level of abstraction on the writer to target other HDLs than Verilog.

Add support for structures

Add support for C-style structs, to build composed types.
This should not be too hard, a struct simply becomes an array of bits, each member has an index and bit-width.
Some important points:

  • we want nested structures
  • what to do with structures containing arrays?
  • if structures cannot contain arrays then we could specify layout (array of structs; vs struct of arrays)
  • initializers? (especially when nesting structures ...)
  • needs proper type checking!!

Write custom parser for better syntax error reporting

Silice uses ANTLR, which was great to get started and focus on the essential.
Now, to produce a nice, useful syntax error reporting, a custom parser is important. As the language stabilizes this will become a must have.

Compile time type checking

Add checks for bit-width and signed/unsigned mismatches (with either warning or error depending on command line flag). In particular detect the use of unsigned operators on signed quantities (e.g << versus <<<).

Wrong combinational cycle detection?

Triggers a cycle detection on sec_c_o , but this seems ok

                  tmp1_h    = (sec_c_o   * invd_h);
                  tmp2_m    = tmp1_m <<< $FPm$;
                  sec_c_o   = tmp2_m;
                  $macro_to_h('tmp1_h','c_o')$ // shift and round
                  if (btm > c_o) {
                    sec_c_o = tmp2_m + ((btm - c_o) * d_m); // offset texturing
                    c_o     = btm;
                  } else { if (top < c_o) {
                    sec_c_o = tmp2_m + ((top - c_o) * d_m); // offset texturing
                    c_o     = top;
                  } }

Locally declared variables

Finalize local (per-block) variables declaration to properly handle:

  • scope
  • init in block
    This should also work within a circuitry.

Update documentation.

Allow bitfield to be used in variable and memory (bram*) declarations

The bitfield provides a definition of an uintN where N is the total width. For completeness and to avoid any hardcoded widths, it is important to be able to use the bitfield name in declarations. For example usage see:

input uint18 rdata, // NOTE, TODO: allow to use bitfield name (DrawColumn)

as well as:

// NOTE, TODO: cannot yet declare the bram with the bitfield
// bram DrawColumn columns[320] = {};
$$if HAS_COMPUTE_CLOCK then
dualport_bram uint18 columns<@clock,@sdram_clock>[320] = {};
$$else
dualport_bram uint18 columns[320] = {};
$$end

Chaining subroutine calls

When chaining calls to subroutines it is possible to save one cycle:

(...a,b,c,...) <- sub1 <- (...);
(...) <- sub2 <- (...a,b,c,...);

Normally, there would be one cycle wasted in between due to return/setup params/call, but we could chain the calls by having sub1 directly jump to sub2. The trick is to modify the entry point of subroutines to have not only the 'standard' call but also context dependent calls that are determined at compile time. The call to sub2 would land in the state that directly pipes the output of sub1 used as input by sub2 (a,b,c).

This can be useful when writing code where subroutines are, in a sense, instructions (pieces of circuits to be reused multiple times), and the chain of subroutines describes a 'program' (sequence of instructions). This would make this type of coding more attractive.

Coder comfort improvements

Some comfort improvements:

  • [done] allow variable declaration within code (with block scope)
    => need to add per-block init

  • [done] preprocessor line markers ($$) have to be exactly on line start, relax (allow spaces)

  • [todo] allow if () {} else if () {} (without brackets on else of first if)

  • [done] allow whole group to be declared as input or output in algorithm parameters (equivalent to declaring all members as either input or output)

  • [done] relax declaration order, interleave vars, algos and subroutines

Possibility to define views of packed bitfields

We often pack multiple entires in wide bitfields.

For instance
uint32 v = 32hffff0101;

We could define a 'pack' as

pack lo_hi = {
  int16   a;
  uint16 b;
}

and then

uint32 v = lo_hi(a=16hffff,b=16h0101);
lo_hi(v).a
lo_hi(v).b

The initializer uses names so we can later rearrange the pack without having to modify it.

Careful though that casting would require a temporary ... unless $signed() does the job?

NOTE: this relates to structs, but is a weaker form.

Native support for inout

Like brams, inouts can become structs with three members (see sdramctrl.ice) generating a special module.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.