1
0
SEm-Labos/01-WaveformGenerator/WaveformGenerator/hdl/triangleToPolygon_studentVersion.vhd

28 lines
837 B
VHDL
Raw Normal View History

2024-02-23 13:01:05 +00:00
ARCHITECTURE studentVersion OF triangleToPolygon IS
2024-03-01 13:24:40 +00:00
signal mySignal : unsigned(bitNb downto 0);
constant aFullTriangle : unsigned(bitNb downto 0) := (others => '1');
2024-02-23 13:01:05 +00:00
BEGIN
2024-03-01 13:24:40 +00:00
convert: process(triangle)
begin
if (('0' & triangle) + ('0' & shift_right(triangle, 1))) < shift_right(aFullTriangle, 3) then
mySignal <= shift_right(aFullTriangle,3);
elsif (('0' & triangle) + ('0' & shift_right(triangle, 1))) > (shift_right(aFullTriangle, 1) + shift_right('0' & aFullTriangle, 3)) then
mySignal <= (shift_right(aFullTriangle,1) + shift_right(aFullTriangle,3));
elsif '1' then
mySignal <= ('0' & triangle) + ('0' & shift_right(triangle, 1) );
end if ;
end process convert;
polygon <= resize(mySignal-shift_right('0' & aFullTriangle,3), bitNb);
2024-02-23 13:01:05 +00:00
END ARCHITECTURE studentVersion;