Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Dedicated Classes for IEEE 754 and Recoded Format Conversion #82

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions hardfloat/tests/src/ValExec_fNFromRecFN.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,27 @@ package hardfloat.test
import hardfloat._
import chisel3._

// Put these functions into dedicated classes so that the generated RTL
// provides dedicated conversion modules that we can instantiate when needed

class fn_from_recfn(expWidth: Int, sigWidth: Int) extends RawModule
{
val io = IO(new Bundle {
val i = Input(UInt((expWidth + sigWidth + 1).W))
val o = Output(Bits((expWidth + sigWidth).W))
})
io.o := fNFromRecFN(expWidth, sigWidth, io.i)
}

class recfn_from_fn(expWidth: Int, sigWidth: Int) extends RawModule
{
val io = IO(new Bundle {
val i = Input(Bits((expWidth + sigWidth).W))
val o = Output(UInt((expWidth + sigWidth + 1).W))
})
io.o := recFNFromFN(expWidth, sigWidth, io.i)
}

class ValExec_fNFromRecFN(expWidth: Int, sigWidth: Int) extends Module
{
val io = IO(new Bundle {
Expand All @@ -49,8 +70,12 @@ class ValExec_fNFromRecFN(expWidth: Int, sigWidth: Int) extends Module
val pass = Output(Bool())
})

io.out :=
fNFromRecFN(expWidth, sigWidth, recFNFromFN(expWidth, sigWidth, io.a))
val encode = Module(new recfn_from_fn(expWidth, sigWidth))
val decode = Module(new fn_from_recfn(expWidth, sigWidth))

encode.io.i := io.a
decode.io.i := encode.io.o
io.out := decode.io.o

io.check := true.B
io.pass := (io.out === io.a)
Expand Down
Loading