cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
raymondxuym
Visitor
Visitor
2,408 Views
Registered: ‎09-11-2017

get_cells for all flops and RAM

Jump to solution

Hi Guys:

I have a design on VCU118 and I would like to mimic the randomized flops/block RAM initial value as the ASIC goes. Does anyone know the command to set all flops and RAM to a randomized 0 or 1?

I aware that we can do  a “set_property INIT 1'b1 ” but that only work for fixed 0 or 1.

And know how can I get_cells for all flops and RAM?

 

Thanks,

Ray

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
hongh
Moderator
Moderator
2,218 Views
Registered: ‎11-04-2010

Hi, @raymondxuym ,

The commands I show you can make every register randomized to be 0/1 and print out the value applied to the register.

You can comment the "puts" if you don't need printing. 

set my_cell [get_cells -hier -filter {IS_PRIMITIVE==1 && LIB_CELL==FDRE}]

foreach temp_cell $my_cell {
if {[expr rand()] > 0.5} {
set tt 1
} else {
set tt 0 
}
set_property INIT $tt $temp_cell

puts  "$temp_cell 's initial value is $tt"
}

 

-------------------------------------------------------------------------
Don't forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------

View solution in original post

0 Kudos
11 Replies
eschidl
Xilinx Employee
Xilinx Employee
2,368 Views
Registered: ‎10-19-2011

Hi @raymondxuym,

for a random value you could use this:

set_property INIT [expr int(rand()+0.5)] [get_cells -hier -filter {IS_PRIMITIVE==1 && LIB_CELL==FDRE}]

------------------------------------------------------------------------------
Don't forget to reply, give kudo and accept as solution
------------------------------------------------------------------------------
0 Kudos
raymondxuym
Visitor
Visitor
2,362 Views
Registered: ‎09-11-2017

Thanks for the reply!

 

I can get it applied when using:

set_property INIT 1'b1 [get_cells -hier -filter {IS_PRIMITIVE==1 && LIB_CELL==FDRE}]

 

However when I use the command of:

set_property INIT [expr init(rand()+0.5)] [get_cells -hier -filter {IS_PRIMITIVE==1 && LIB_CELL==FDRE}]

 

There is a tcl error pops up:

invalid command name "tcl::mathfunc::init"

 

Any idea?

Thanks,

Ray

0 Kudos
hongh
Moderator
Moderator
2,336 Views
Registered: ‎11-04-2010

Hi, @raymondxuym ,

Please try the below commands:

set my_cell [get_cells -hier -filter {IS_PRIMITIVE==1 && LIB_CELL==FDRE}]

foreach temp_cell $my_cell {
if {[expr rand()] > 0.5} {
set tt 1
} else {
set tt 0
}
set_property INIT $tt $temp_cell
}

-------------------------------------------------------------------------
Don't forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
eschidl
Xilinx Employee
Xilinx Employee
2,317 Views
Registered: ‎10-19-2011

Hi @raymondxuym,

seems I made a little typo there. It needs to be int() and not init().

------------------------------------------------------------------------------
Don't forget to reply, give kudo and accept as solution
------------------------------------------------------------------------------
0 Kudos
hongh
Moderator
Moderator
2,306 Views
Registered: ‎11-04-2010

Hi, @raymondxuym , 

Are the initial value for all the registers are different random values?

Or the initial value for all the registers are same, and random to be '1' or  '0'  ?

-------------------------------------------------------------------------
Don't forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
0 Kudos
raymondxuym
Visitor
Visitor
2,241 Views
Registered: ‎09-11-2017

Thank you very much@hongh!

I'm looking for "the initial value for all the registers are different random values".

If that could not be achieved, maybe I have to do all 1, rather than all 0 which is the default.

 

Thanks and best,

Ray

0 Kudos
raymondxuym
Visitor
Visitor
2,236 Views
Registered: ‎09-11-2017

Hi @eschidl:

 

Thank you this way works!

I was wondering, is there a way to make every register randomized to be 0/1, rather than applying a random 0/1 to all registers?

 

Thanks,

Ray

0 Kudos
hongh
Moderator
Moderator
2,219 Views
Registered: ‎11-04-2010

Hi, @raymondxuym ,

The commands I show you can make every register randomized to be 0/1 and print out the value applied to the register.

You can comment the "puts" if you don't need printing. 

set my_cell [get_cells -hier -filter {IS_PRIMITIVE==1 && LIB_CELL==FDRE}]

foreach temp_cell $my_cell {
if {[expr rand()] > 0.5} {
set tt 1
} else {
set tt 0 
}
set_property INIT $tt $temp_cell

puts  "$temp_cell 's initial value is $tt"
}

 

-------------------------------------------------------------------------
Don't forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------

View solution in original post

0 Kudos
eschidl
Xilinx Employee
Xilinx Employee
2,200 Views
Registered: ‎10-19-2011

Hi @raymondxuym,

per default all flip flops are initialised to the INIT attribute during the startup sequence. And the default for the INIT is '0' for FDCE and FDRE, and '1' for FDPE and FDSE.
You can check that in ug974, page 226 and following.

There is no specific Vivado Tcl command I know of that would randomise this initial value. You would need to do this yourself and the code myself and @hongh pointed out would do exactly that.

------------------------------------------------------------------------------
Don't forget to reply, give kudo and accept as solution
------------------------------------------------------------------------------
raymondxuym
Visitor
Visitor
2,111 Views
Registered: ‎09-11-2017

@hongh Exactly what I'm looking for, thank you so much!

0 Kudos
raymondxuym
Visitor
Visitor
2,088 Views
Registered: ‎09-11-2017

@eschidl Thank you for the info, worked it out with both of your help!

0 Kudos