Altera_Forum
Honored Contributor
16 years agoCustom Component Help
Hi all, I'm sorry if this question if too broad, but I'm a beginner to custom components and I need some help. My final goal is to have a custom component in SOPC builder, that performs the SHA-256 hashing algorithm (takes a message in, outputs the hash of the message). I have a VHDL entity that functions as an FSM that computes the SHA hash in 20us (not optimized at all), that I want to make into a custom component. I want the Nios to set the input to the component, wait 20us, and then receive the output.
I have been doing a lot of reading on custom components and the avalon fabric, but I still find it very confusing to define my component in terms of all the signals necessary for avalon master/slave communication. Without any of those, my entity declaration is as follows:entity SHA_Unit is
port(
clk: in std_logic;
rst: in std_logic;
message: in std_logic_vector(255 downto 0);
hash: out std_logic_vector(255 downto 0)
);
end SHA_Unit; Could anyone help me turn this entity into an avalon MM slave peripheral with the nios acting as the master? I can't find any VHDL examples for creating a custom component both in the VHDL and in the C parts. Does anyone know of an example, something as simple as an adder or something? Also, I don't know how to address the fact that my component requires 256 bits of data, while the nios seems only to output up to 32 bits (in pio form anyway). Sorry for the overly general nature of this question, Max