Skip to content

Raw HDL Insertion

Julian Kemmerer edited this page Jul 26, 2020 · 22 revisions

The goal of this feature is to approximate the functionality of gcc's __asm__() function.

__asm__() is used to directly describe cpu architecture specific assembler instructions (as opposed to being compiled from higher level C language). Similarly __vhdl__() can be used to insert arbitrary VHDL text into PipelineC functions/modules.

uint64_t main(uint64_t x, uint64_t y) 
{
__vhdl__("\
  -- Arch declarations go here \n\
  begin \n\
  -- The arch body, processes, assignments, etc go here \n\
  return_output <= x + y; \n\
");
}

The above PipelineC produces exactly the below VHDL file.

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library ieee_proposed;
use ieee_proposed.float_pkg.all;
use work.c_structs_pkg.all;
entity main_0CLK_d751 is
port(
 clk : in std_logic;
 x : in unsigned(63 downto 0);
 y : in unsigned(63 downto 0);
 return_output : out unsigned(63 downto 0));
end main_0CLK_d751;
architecture arch of main_0CLK_d751 is
  -- Arch declarations go here 
  begin 
  -- The arch body, processes, assignments, etc go here 
  return_output <= x + y; 
end arch;

Functions that use __vhdl__() are treated as global functions and will not be automatically pipelined.

Alot of hacky stuff could be done this way - however, the plan to to still have as much as possible written in PipelineC and abstracted/generated for you.

Clone this wiki locally