COSCUP2021
Skilled
en
COSCUP2021
Bringing Open Source Software to Hardware
TR313
歡迎來到 https://hackmd.io/@coscup/2021 共筆
Scala code use SpinalHDL API
原本的 low-level API:
var r1 = Bool()
r1.setName("reg1")
r1.setAs(Reg())
var r2 = ...
r1.assign(r2) ;; 大致意思,正確程式請見投影片
用高階 iDSL 協助建構程式、自動推論細節:
var r1, r2 = Reg(Bool())
r1 := r2
轉為 database -> VHDL/verilog -> Hardware
Host language as a elaboration tool
可以自由運用 host language 的特性(而非 iDSL)更加簡化程式,如 for
、 map
等等,而不是把同樣的一行程式複製三遍:
var things = ArrayBuffer[Bool]()
for (idx <- 0 to 2) {
things += Reg(Bool())
}
var logics = things.map(r=>!r)
Host language as a simulation tool
同樣使用 host language 的特性簡化模擬器與除錯器撰寫等
class MyCpu(plugins: List[Plugin]) {
val decode = new Stage
val execute = new Stage
//...
}
class Stage {
val stuck = Bool()
val discard = Bool()
}
Framework compose to SoC,實作 RV32IMAFDC, shared FPU
val a, b = Handle[Int]
val calculator = Handle {
a.get + b.get
}
val printer = Handle {
print(calculate...)
}
a.load(3)
b.load(4)
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing