Skip to content

Commit

Permalink
RoPE 모듈 초안 작성 -> Int임. FP 쓸려면 별도의 라이브러리 필요
Browse files Browse the repository at this point in the history
  • Loading branch information
js4ngu committed Sep 10, 2024
1 parent 2632830 commit 2bb446c
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 58 deletions.
29 changes: 0 additions & 29 deletions src/main/scala/empty/Add.scala

This file was deleted.

24 changes: 24 additions & 0 deletions src/main/scala/vfrope/RoPEModule.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Dummy file to start a Chisel project.
*
* Author: Martin Schoeberl ([email protected])
*
*/

package vfrope

import chisel3._
import chisel3.util._

class RoPEModule(width:Int) extends Module{
val io = IO(new Bundle{
val m = Input(UInt(width.W))
val theta = Input(UInt(width.W))
val i = Input(UInt(width.W))
val out = Output(UInt(width.W))
})

val m_theta_i = RegInit(0.U(width.W))
m_theta_i := io.m * io.theta * io.i
io.out := m_theta_i
}
29 changes: 0 additions & 29 deletions src/test/scala/empty/AddTester.scala

This file was deleted.

17 changes: 17 additions & 0 deletions src/test/scala/vfrope/RoPEModule.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package vfrope

import chisel3._
import chiseltest._
import org.scalatest.flatspec.AnyFlatSpec

class RoPEModuleTester extends AnyFlatSpec with ChiselScalatestTester {
"RoPEModule" should "work" in {
test(new RoPEModule(width = 8)) { dut =>
dut.io.m.poke(2.U)
dut.io.theta.poke(1.U)
dut.io.i.poke(1.U)
dut.clock.step(1)
dut.io.out.expect(2.U)
}
}
}

0 comments on commit 2bb446c

Please sign in to comment.