Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
language:interface [2023/04/09 18:56] rajit [Interfaces] |
language:interface [2023/04/09 19:01] (current) rajit [Parameter types] |
||
---|---|---|---|
Line 27: | Line 27: | ||
==== Parameter types ==== | ==== Parameter types ==== | ||
- | |||
- | **Needs to be updated** | ||
The special '' | The special '' | ||
Line 49: | Line 47: | ||
<code act> | <code act> | ||
// A constructor for a datapath with W-bit ripple connections, | // A constructor for a datapath with W-bit ripple connections, | ||
- | // where each component has M inputs and one output | + | // where each component has an additional |
- | // A skeleton | + | // Interface definition |
template< | template< | ||
- | defproc | + | interface |
- | | + | |
// the constructor | // the constructor | ||
Line 61: | Line 58: | ||
| | ||
{ | { | ||
- | t x[N]; | + | t x[N]; // array of type " |
// ripple connections | // ripple connections | ||
- | (;i:N-1: x[i].rout=x[i+1].rin); | + | |
| | ||
- | | + | |
+ | |||
// i/o connections | // i/o connections | ||
- | (;i:N: x[i].in[i*M..(i+1)*M-1] | + | (i:N: x[i].in = in[i*M..(i+1)*M-1]; |
- | x[i].out=out[i] ) | + | x[i].out=out[i]; ) |
} | } | ||
- | // A one-bit adder | + | // A one-bit adder, that exports the bitslice interface |
- | defproc onebit (e1of2? in[2], rin[1]; e1of2! out, rout[1]) { ... } | + | defproc onebit (e1of2? in[2], rin[1]; e1of2! out, rout[1]) |
+ | :> | ||
+ | { ... } | ||
defproc ripple_adder (e1of2? a[32], b[32], cin; e1of2! out[32], cout) | defproc ripple_adder (e1of2? a[32], b[32], cin; e1of2! out[32], cout) | ||
{ | { | ||
- | build_dpath< | + | build_dpath< |
- | (; i : 32 : dp.in[2*i] = a[i]; dp.in[2*i+1] = b[i]); | + | (i : 32 : dp.in[2*i] = a[i]; dp.in[2*i+1] = b[i];) |
dp.out = out; | dp.out = out; | ||
dp.rin[0] = cin; | dp.rin[0] = cin; | ||
- | dp.rout[0] = cout | + | dp.rout[0] = cout; |
} | } | ||
</ | </ | ||
+ | |||
+ | Process type ('' | ||