Skip to content

affectioned/mem2verilog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mem2verilog

If you daily-drive Windows: You can make a persistent Ubuntu USB boot drive with Rufus that saves your data, so you can boot into Linux, run this tool, and then return to Windows without losing anything on your Ubuntu setup.

If you’re new to compiling C on Linux: Follow this guide to learn how to create and build the .c file:
https://medium.com/@filip.melka/your-first-c-program-on-linux-a-quick-guide-with-vim-and-vscodium-bc941228d4b2

About the code: Based on the DMA-CFW-Guide snippet, but improved for easier copy-pasting of larger BAR dumps.


Maps 4 KB of a PCI BAR and dumps it in Verilog format to both terminal and output.txt.
Root required & Secure Boot must be disabled.

Build

gcc -o bardump bar.c

Usage

sudo ./bardump <device_or_file>
# Example:
sudo ./bardump /sys/bus/pci/devices/0000:01:00.0/resource0

Example Output

Opening File : /sys/bus/pci/devices/0000:01:00.0/resource0
PCI Memory mapped to: 0x7f8b2b1d4000.
16'h0000 : rd_rsp_data <= 32'hDEADBEEF;
16'h0004 : rd_rsp_data <= 32'h12345678;
...

About

Dumps 4 KB from a PCI BAR to terminal and output.txt in Verilog format

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages