UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer adrianf0
Observer
4,894 Views
Registered: ‎01-25-2013

extract USR_ACCESS from a bit file

Is there any recommended way to extract USR_ACCESS value from the bit file ? Any tcl command ?

 

It's easy to find the USR_ACCESS in the bitfile header using a hex editor. However, is its position fixed ? Does 0xA001 indicate the 32-bit USR_ACCESS field in the bit file ?

 

I would like to write a git hook, which would append the bitfile version into the commit log.

0 Kudos
9 Replies
Visitor traianm
Visitor
3,923 Views
Registered: ‎06-22-2017

Re: extract USR_ACCESS from a bit file

I'm looking for the same thing. Any solutions to this yet?

0 Kudos
Moderator
Moderator
3,904 Views
Registered: ‎04-24-2013

Re: extract USR_ACCESS from a bit file

 

Hi @adrianf0 , @traianm ,

 

User Guide 497 has the following information on the placement of the USER_ACCESS value in the bitstream.

 

 

Capture.PNG

 

 

Alternatively when you have the project open you can use the following command to write out all or selected properties to a file.

 

 

report_property -all -file <file path>/filename [current_design]

This will include the USER_ACCESS value e.g.

BITSTREAM.CONFIG.USR_ACCESS               string   false      0123456

 

Let me know if this helps.

Best Regards
Aidan

 

------------------------------------------------------------------------------------------------------------------
Please mark the Answer as "Accept as solution" if this answered your question
Give Kudos to a post which you think is helpful and may help other users
------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------
Please mark the Answer as "Accept as solution" if this answered your question
Give Kudos to a post which you think is helpful and may help other users
------------------------------------------------------------------------------------------------------------------
0 Kudos
Visitor traianm
Visitor
3,901 Views
Registered: ‎06-22-2017

Re: extract USR_ACCESS from a bit file

Yes, I got that part of the info.

 

I was just wondering if there is a way to extract it, other than me having to write code to do it. Is there a TCL command available in VIVADO to do read this info back from the file?

0 Kudos
Moderator
Moderator
3,895 Views
Registered: ‎04-24-2013

Re: extract USR_ACCESS from a bit file

Hi @traianm,

 

I just updated the answer, you can do so via tcl with the following.

 

When you have the project open you can use the following command to write out all or selected properties to a file.

 

 

report_property -all -file <file path>/filename [current_design]

 

This will include the USER_ACCESS value e.g.

BITSTREAM.CONFIG.USR_ACCESS               string   false      0123456

 

Best Regards
Aidan

 

 

------------------------------------------------------------------------------------------------------------------
Please mark the Answer as "Accept as solution" if this answered your question
Give Kudos to a post which you think is helpful and may help other users
------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------
Please mark the Answer as "Accept as solution" if this answered your question
Give Kudos to a post which you think is helpful and may help other users
------------------------------------------------------------------------------------------------------------------
0 Kudos
Visitor traianm
Visitor
3,889 Views
Registered: ‎06-22-2017

Re: extract USR_ACCESS from a bit file

When I run 

 

report_property -all [current_design]

 

it returns 

 

BITSTREAM.CONFIG.USR_ACCESS              string   false      TIMESTAMP

 

So it basically tells me what the BITSTREAM.CONFIG.USR_ACCESS is set to , but not the value.

 

When I run 

 

report_property -all design_1_wrapper.bit [current_design]

 

it returns an error: 

 

ERROR: [Common 17-58] 'design_1_wrapper.bit' is not a valid first class Tcl object.

0 Kudos
Moderator
Moderator
3,882 Views
Registered: ‎04-24-2013

Re: extract USR_ACCESS from a bit file

Hi @traianm,

 

If you have the USER_ACCESS set to TIMESTAMP then you won't know the value until after the bitstream is written.

 

This is a place holder for telling the tools to put in the date and time and is only a value when write_bitstream access it.

In this case you will have to parse the file generated perhaps using grep or something similar.

 

You could write a tcl script to read the file generated and then extract the line you need e.g.

 

set fp [open "somefile" r]
set file_data [read $fp]

set data [split $file_data "\n"]
foreach line $data {
     # do some line processing here
}
close $fp

 

If you have a value in USER_ACCESS then you can read it back as previously shown or use the following to focus in on it e.g.

report_property -all [current_design] -regexp BITSTREAM.CONFIG.USR_ACCESS

 

Best Regards
Aidan

 

 

------------------------------------------------------------------------------------------------------------------
Please mark the Answer as "Accept as solution" if this answered your question
Give Kudos to a post which you think is helpful and may help other users
------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------
Please mark the Answer as "Accept as solution" if this answered your question
Give Kudos to a post which you think is helpful and may help other users
------------------------------------------------------------------------------------------------------------------
0 Kudos
Visitor traianm
Visitor
3,879 Views
Registered: ‎06-22-2017

Re: extract USR_ACCESS from a bit file

This exactly what I am trying to do. Read the TIMESTAMP value from the file.

 

I know I can write a TCL to do this, but I was wondering/hoping that XILINX has a tcl command already to do this, and save me the time to do it.

 

Looks like i'm on my own, to write a program to do this.

 

Thanks

0 Kudos
1,416 Views
Registered: ‎10-02-2012

Re: extract USR_ACCESS from a bit file

You are not alone ! 

i'm looking for exactly the same thing,let me know if you find an answer.

Thanks. 

 

0 Kudos
Highlighted
Participant jesperjustesen
Participant
1,154 Views
Registered: ‎01-19-2016

Re: extract USR_ACCESS from a bit file

Hi

 

I also wanted to read out the USR_ACCESS value from a bit file.

This is my crude suggestion.

 

proc read_usr_access_register_from_bit_file {file} {
    
    set fp [open $file r]
    fconfigure $fp -translation binary
    set data [read $fp]
    close $fp

    # Search for command preceding USR_ACCESS value and extract subsequent 32-bit value
    set numberOfMatches [regexp -all {\x30\x01\xA0\x01(....)} $data -> match]

    puts "USR_ACCESS register \[Unicode values\] : [scan $match %c%c%c%c]"
    
    # Convert to integer and return
    binary scan $match Iu integer
    return $integer
}

BR Jesper