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)[https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Extended-Asm] __asm__() function.

__asm()__ is used to directly describe cpu architecture specific assembler instructions (as opposed to being compiler 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; \
");
}```

The above PipelineC produces examples the below VHDL file.

```c

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;
Clone this wiki locally