11. オープンなISA
RISC-Vの場合
The RISC-V ISA is free and open with a permissive license for use by
anyone in all types of implementations. Designers are free to develop
proprietary or open source implementations for commercial or other
exploitations as they see fit. The RISC-V Foundation encourages all
implementations that are compliant to the specifications.
13. RISC-Vの命令 https://riscv.org/specifications/
• RV32I – Base Integer Instruction Set
• RV32E – Reduced version of RV32I
• RV64I – supported user address space to 64bits
• RV128I – a flat 128-bit address space
35. Chisel
import chisel3._
class Top(in0Bits: Int, in1Bits: Int) extends Module {
val io = IO(new Bundle {
val in0 = Input(UInt(in0Bits.W))
val in1 = Input(UInt(in0Bits.W))
val out = Output(UInt((in0Bits+1).W))
})
io.out := io.in0 + io.in1
}
object Elaborate extends App {
chisel3.Driver.execute(args, () => new Top(32, 32))
}
Scalaでハードウェアを設計する
https://www.tech-diningyo.info/entry/2019/02/22/234336 より
36. Chisel
package examples
import chisel3._
import chisel3.util._
//A 4-bit adder with carry in and carry out
class Adder4 extends Module {
val io = IO(new Bundle {
val A = Input(UInt(4.W))
val B = Input(UInt(4.W))
val Cin = Input(UInt(1.W))
val Sum = Output(UInt(4.W))
val Cout = Output(UInt(1.W))
})
//Adder for bit 0
val Adder0 = Module(new FullAdder())
Scalaでハードウェアを設計する
Adder0.io.a := io.A(0)
Adder0.io.b := io.B(0)
Adder0.io.cin := io.Cin
val s0 = Adder0.io.sum
//Adder for bit 1
val Adder1 = Module(new FullAdder())
Adder1.io.a := io.A(1)
Adder1.io.b := io.B(1)
Adder1.io.cin := Adder0.io.cout
val s1 = Cat(Adder1.io.sum, s0)
//Adder for bit 2
val Adder2 = Module(new FullAdder())
Adder2.io.a := io.A(2)
Adder2.io.b := io.B(2)
Adder2.io.cin := Adder1.io.cout
...
https://github.com/ucb-bar/chisel-tutorial より
37. Chisel
package examples
import chisel3._
import chisel3.util._
class Adder(val n:Int) extends Module {
val io = IO(new Bundle {
val A = Input(UInt(4.W))
val B = Input(UInt(4.W))
val Cin = Input(UInt(1.W))
val Sum = Output(UInt(4.W))
val Cout = Output(UInt(1.W))
})
...
Scalaでハードウェアを設計する
//first carry is the top level carry in
carry(0) := io.Cin
//wire up the ports of the full adders
for (i <- 0 until n) {
FAs(i).a := io.A(i)
FAs(i).b := io.B(i)
FAs(i).cin := carry(i)
carry(i+1) := FAs(i).cout
sum(i) := FAs(i).sum.toBool()
}
io.Sum := sum.asUInt
io.Cout := carry(n)
...
https://github.com/ucb-bar/chisel-tutorial より