Author Topic: Translating C code to Verilog  (Read 1727 times)

0 Members and 1 Guest are viewing this topic.

Offline jeremy

  • Frequent Contributor
  • **
  • Posts: 938
  • Country: au
Translating C code to Verilog
« on: February 14, 2014, 10:56:49 am »
Hi all,

Does anyone have any good resources on taking algorithms implemented in C and translating them to HDL? I know there are lots of tools out there which offer various degrees of automated translation, but I am interested in doing it myself.
 

Offline AlfBaz

  • Super Contributor
  • ***
  • Posts: 2041
  • Country: au
Re: Translating C code to Verilog
« Reply #1 on: February 14, 2014, 11:08:13 am »
I'm by no means a vhdl expert but I suggest you just take it on. I managed to implement bresenham's line drawing algorithm from C code without to much trouble
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: Translating C code to Verilog
« Reply #2 on: February 14, 2014, 02:57:14 pm »
I usually do two things:

1) Understand what the original code was doing, and how it did it. Then replicate the approach and structure in the target language; This works better if the original code is well designed and documented.
2) Write you own. Essentially replicating the functionality of the original code without replicating the code itself. This works better if you find it unproductive trying to understand a poorly written and documented piece of code.
================================
https://dannyelectronics.wordpress.com/
 

Offline NANDBlog

  • Super Contributor
  • ***
  • Posts: 4661
  • Country: nl
  • Current job: ATEX certified product design
Re: Translating C code to Verilog
« Reply #3 on: February 14, 2014, 04:32:36 pm »
You put a soft processor on your FPGA, then you run the code on that.
C code is sequential, HDL is concurrent. They are the least alike.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf