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

0 Members and 1 Guest are viewing this topic.

Offline jeremyTopic starter

  • Super Contributor
  • ***
  • Posts: 1079
  • 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: 2184
  • 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: 8221
  • 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 tszaboo

  • Super Contributor
  • ***
  • Posts: 7364
  • Country: nl
  • Current job: ATEX 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