How to assign large constant (Declearing large constant value ) - chisle

20 views
Skip to first unread message

riaz mian

unread,
Apr 11, 2020, 8:16:59 AM4/11/20
to chisel-users

Here is my code:


val BaseBillion64PP = Reg(Vec(Seq.fill(4)(0.U(64.W))))
val BaseBillion32PP = Reg(Vec(Seq.fill(4)(0.U(32.W))))

val Billion = 1000000000.U
val Magic  = 2305843009.U    
val hop_1  = BaseBillion64PP(0)>>29.U
val est_1  = (hop_1*Magic)>>32.U
 BaseBillion32PP(1) :=  (BaseBillion64PP_1 - (est_2*Billion))

it shows the following error

integer number too large
[error]             Magic   := 2305843009.U 

my question how can i run the expression (hop_1*Magic)>>32.U and the value should be 2305843009

Claford Lawrence

unread,
Apr 11, 2020, 8:19:29 AM4/11/20
to chisel-users
Use BigInt.
val Billion = BigInt("1000000000", 10).U

sajjad ahmed

unread,
Apr 11, 2020, 8:27:44 AM4/11/20
to chisel...@googlegroups.com
You can use long type of Scala by placing L at the end of any long Int value
E.g
Val variable = 409678L.U

--
You received this message because you are subscribed to the Google Groups "chisel-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chisel-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chisel-users/1b9aa85f-8c4c-4db0-baa2-af121385c6a1%40googlegroups.com.

riaz mian

unread,
Apr 11, 2020, 9:49:20 AM4/11/20
to chisel-users
It works thanks
Reply all
Reply to author
Forward
0 new messages