I would like Synthesize topEntity to generate the following code Note packet_control_t is predefined type:
library nuand;
use nuand.fifo_readwrite_p.all;
entity gnodeb_top is
port (
tx_clock : in std_logic ;
tx_reset : in std_logic ;
tx_packet_control : in packet_control_t;
tx_packet_empty : in std_logic;
tx_packet_ready : out std_logic;
tx_leds : out std_logic_vector( 2 downto 0)
) ;
end gnodeb_top ;
Instead the generated code looks as follows:
entity gnodeb_top is
port(-- clock
tx_clock : in gnodeb_top_types.clk_System;
-- reset
tx_reset : in gnodeb_top_types.rst_System;
tx_packet_control : in std_logic_vector(50 downto 0);
tx_packet_empty : in boolean;
tx_packet_ready : out boolean;
tx_leds : out std_logic_vector(2 downto 0));
end;
My Clash code looks as follows:
import Clash.Prelude
import Clash.Signal
import Clash.Annotations.TopEntity
import Clash.Annotations.Primitive
import Data.String.Interpolate (__i)
-- PacketControl type matching VHDL packet_control_t record
data PacketControl = PacketControl
{ pktCoreId :: Vec 8 Bit -- std_logic_vector(7 downto 0)
, pktFlags :: Vec 8 Bit -- std_logic_vector(7 downto 0)
, pktSop :: Bool -- std_logic
, pktEop :: Bool -- std_logic
, pktData :: Vec 32 Bit -- std_logic_vector(31 downto 0)
, dataValid :: Bool -- std_logic
} deriving (Show)
{-# ANN type PacketControl (InlinePrimitive [VHDL] [__i|
BlackBox:
kind: Declaration
name: GNodeBTop.PacketControl
template: |-
packet_control_t
|] ) #-}
-- Top entity definition
topEntity
:: "tx_clock" ::: Clock System
-> "tx_reset" ::: Reset System
-> "tx_packet_control" ::: PacketControl
-> "tx_packet_empty" ::: Signal System Bool
-> ( "tx_packet_ready" ::: Signal System Bool
, "tx_leds" ::: Signal System (Vec 3 Bit)
)
topEntity txClock txReset txPacketControl txPacketEmpty =
( txPacketReady
, txLeds
)
where
-- These are placeholder implementations
txPacketReady = pure False
txLeds = pure (repeat low)
{-# ANN topEntity
(Synthesize
{ t_name = "gnodeb_top"
, t_inputs = [ PortName "tx_clock"
, PortName "tx_reset"
, PortName "tx_packet_control"
, PortName "tx_packet_empty"
]
, t_output = PortProduct ""
[ PortName "tx_packet_ready"
, PortName "tx_leds"
]
}) #-}
How can I define my BlackBox to achieve the desired VHDL?