Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
11 years ago

System Console script for Avalon-MM access

Hi,

does anyone have a .tcl-script for writing data via the System Console to Avalon-MM slaves that he/she want's to share?

Cheers, Peter

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Here's a pretty basic script ...

    #  -----------------------------------------------------------------#  jtag_cmds.tcl# #  11/9/2014 D. W. Hawkins (dwh@ovro.caltech.edu)# #  SystemConsole commands.# #  -----------------------------------------------------------------
    #  =================================================================#  Master access#  =================================================================# #  -----------------------------------------------------------------#  Open the JTAG master service#  -----------------------------------------------------------------
    #  Open the first Avalon-MM master service
    proc jtag_open {} {
        global jtag
       #  Close any open service
        if {} {
            jtag_close
        }
        set master_paths 
        if { == 0} {
            puts "Sorry, no master nodes found"
            return
        }
       #  Select the first master service
        set jtag(master) 
        open_service master $jtag(master)
        return
    }
    #  -----------------------------------------------------------------#  Close the JTAG master service#  -----------------------------------------------------------------# 
    proc jtag_close {} {
        global jtag
        if {} {
            close_service master $jtag(master)
            unset jtag(master)
        }
        return
    }
    #  -----------------------------------------------------------------#  JTAG-to-Avalon-MM bridge read/write#  -----------------------------------------------------------------# 
    proc jtag_read {addr} {
        global jtag
        if {!} {
            jtag_open
        }
       #  Read 32-bits
        set data 
        return $data
    }
    proc jtag_write {addr data} {
        global jtag
        if {!} {
            jtag_open
        }
       #  Write 32-bits
        master_write_32 $jtag(master) $addr 
        return
    }
    

    You can start System Console and then type

    tcl> source jtag_cmds.tcl

    and then you can type jtag_read <address> or jtag_write <address> <data>

    These are dead-simple procedures. They are *not* efficient for transferring large amounts of data. Check out the other master procedures for better options (or ask).

    Cheers,

    Dave