lkolbly / ripstop

Apache License 2.0
0 stars 0 forks source link

Replication & Reduction operators #32

Open lkolbly opened 2 years ago

lkolbly commented 2 years ago

So Verilog has the replication operator: N{X} which repeats X N times. That's useful for things like:

s_tready[t] = (m_tready[t] & m_tvalid[t]) ++ (m_tready[t] & m_tvalid[t]);

where you want to smear the same value across a new value.

Also, it has a variety of reduction operators: https://verilogcodes.blogspot.com/2015/10/unary-or-reduction-operators-in-verilog.html e.g. &x (in isolation) ANDs all the bits within x together.

These concepts may be things that only apply to array-types. For example, &x where x is a bits<32>[5] I would expect would be something like x[0] & x[1] & x[2] & x[3] & x[4].