Archived
1
0

start Task 5

This commit is contained in:
2024-04-09 11:46:35 +02:00
parent 95d5c14ee7
commit 7f4a0c615f
36 changed files with 10015 additions and 254 deletions

View File

@ -1,51 +1,341 @@
ARCHITECTURE studentVersion OF charToMorseController IS
signal isA, isB, isC, isD, isE, isF, isG, isH,
isI, isJ, isK, isL, isM, isN, isO, isP,
isQ, isR, isS, isT, isU, isV, isW, isX,
isY, isZ,
is0, is1, is2, is3, is4, is5, is6, is7,
is8, is9 : std_ulogic;
signal isA, isB, isC, isD, isE, isF, isG, isH,
isI, isJ, isK, isL, isM, isN, isO, isP,
isQ, isR, isS, isT, isU, isV, isW, isX,
isY, isZ,
is0, is1, is2, is3, is4, is5, is6, is7,
is8, is9 : std_ulogic;
type T_MORSE is (SHORT, LONG, SPACE, END_WORD);
--type registers_type is array (1 to 5) of T_MORSE;
signal register1: T_MORSE;
signal register2: T_MORSE;
signal register3: T_MORSE;
signal register4: T_MORSE;
signal register5: T_MORSE;
TYPE GENERAL_STATE_TYPE IS (
waitForChar,
storeChar,
sendRegisters,
sended
);
signal general_current_state, general_next_state : GENERAL_STATE_TYPE;
TYPE SENDING_STATE_TYPE IS (
waiting,
sendR1,
waitR1,
sendR2,
waitR2,
sendR3,
waitR3,
sendR4,
waitR4,
sendR5,
waitEndWord
);
signal sending_current_state, sending_next_state : SENDING_STATE_TYPE;
BEGIN
------------------------------------------------------------------------------
-- conditions for morse units
isA <= '1' when std_match(unsigned(char), "1-0" & x"1") else '0';
isB <= '1' when std_match(unsigned(char), "1-0" & x"2") else '0';
isC <= '1' when std_match(unsigned(char), "1-0" & x"3") else '0';
isD <= '1' when std_match(unsigned(char), "1-0" & x"4") else '0';
isE <= '1' when std_match(unsigned(char), "1-0" & x"5") else '0';
isF <= '1' when std_match(unsigned(char), "1-0" & x"6") else '0';
isG <= '1' when std_match(unsigned(char), "1-0" & x"7") else '0';
isH <= '1' when std_match(unsigned(char), "1-0" & x"8") else '0';
isI <= '1' when std_match(unsigned(char), "1-0" & x"9") else '0';
isJ <= '1' when std_match(unsigned(char), "1-0" & x"A") else '0';
isK <= '1' when std_match(unsigned(char), "1-0" & x"B") else '0';
isL <= '1' when std_match(unsigned(char), "1-0" & x"C") else '0';
isM <= '1' when std_match(unsigned(char), "1-0" & x"D") else '0';
isN <= '1' when std_match(unsigned(char), "1-0" & x"E") else '0';
isO <= '1' when std_match(unsigned(char), "1-0" & x"F") else '0';
isP <= '1' when std_match(unsigned(char), "1-1" & x"0") else '0';
isQ <= '1' when std_match(unsigned(char), "1-1" & x"1") else '0';
isR <= '1' when std_match(unsigned(char), "1-1" & x"2") else '0';
isS <= '1' when std_match(unsigned(char), "1-1" & x"3") else '0';
isT <= '1' when std_match(unsigned(char), "1-1" & x"4") else '0';
isU <= '1' when std_match(unsigned(char), "1-1" & x"5") else '0';
isV <= '1' when std_match(unsigned(char), "1-1" & x"6") else '0';
isW <= '1' when std_match(unsigned(char), "1-1" & x"7") else '0';
isX <= '1' when std_match(unsigned(char), "1-1" & x"8") else '0';
isY <= '1' when std_match(unsigned(char), "1-1" & x"9") else '0';
isZ <= '1' when std_match(unsigned(char), "1-1" & x"A") else '0';
is0 <= '1' when std_match(unsigned(char), "011" & x"0") else '0';
is1 <= '1' when std_match(unsigned(char), "011" & x"1") else '0';
is2 <= '1' when std_match(unsigned(char), "011" & x"2") else '0';
is3 <= '1' when std_match(unsigned(char), "011" & x"3") else '0';
is4 <= '1' when std_match(unsigned(char), "011" & x"4") else '0';
is5 <= '1' when std_match(unsigned(char), "011" & x"5") else '0';
is6 <= '1' when std_match(unsigned(char), "011" & x"6") else '0';
is7 <= '1' when std_match(unsigned(char), "011" & x"7") else '0';
is8 <= '1' when std_match(unsigned(char), "011" & x"8") else '0';
is9 <= '1' when std_match(unsigned(char), "011" & x"9") else '0';
isA <= '1' when std_match(unsigned(char), "1-0" & x"1") else '0'; -- 1-0 0001
isB <= '1' when std_match(unsigned(char), "1-0" & x"2") else '0'; -- 1-0 0010
isC <= '1' when std_match(unsigned(char), "1-0" & x"3") else '0'; -- 1-0 0011
isD <= '1' when std_match(unsigned(char), "1-0" & x"4") else '0'; -- 1-0 0100
isE <= '1' when std_match(unsigned(char), "1-0" & x"5") else '0'; -- 1-0 0101
isF <= '1' when std_match(unsigned(char), "1-0" & x"6") else '0'; -- 1-0 0110
isG <= '1' when std_match(unsigned(char), "1-0" & x"7") else '0'; -- 1-0 0111
isH <= '1' when std_match(unsigned(char), "1-0" & x"8") else '0'; -- 1-0 1000
isI <= '1' when std_match(unsigned(char), "1-0" & x"9") else '0'; -- 1-0 1001
isJ <= '1' when std_match(unsigned(char), "1-0" & x"A") else '0'; -- 1-0 1010
isK <= '1' when std_match(unsigned(char), "1-0" & x"B") else '0'; -- 1-0 1011
isL <= '1' when std_match(unsigned(char), "1-0" & x"C") else '0'; -- 1-0 1100
isM <= '1' when std_match(unsigned(char), "1-0" & x"D") else '0'; -- 1-0 1101
isN <= '1' when std_match(unsigned(char), "1-0" & x"E") else '0'; -- 1-0 1110
isO <= '1' when std_match(unsigned(char), "1-0" & x"F") else '0'; -- 1-0 1111
isP <= '1' when std_match(unsigned(char), "1-1" & x"0") else '0'; -- 1-1 0000
isQ <= '1' when std_match(unsigned(char), "1-1" & x"1") else '0'; -- 1-1 0001
isR <= '1' when std_match(unsigned(char), "1-1" & x"2") else '0'; -- 1-1 0010
isS <= '1' when std_match(unsigned(char), "1-1" & x"3") else '0'; -- 1-1 0011
isT <= '1' when std_match(unsigned(char), "1-1" & x"4") else '0'; -- 1-1 0100
isU <= '1' when std_match(unsigned(char), "1-1" & x"5") else '0'; -- 1-1 0101
isV <= '1' when std_match(unsigned(char), "1-1" & x"6") else '0'; -- 1-1 0110
isW <= '1' when std_match(unsigned(char), "1-1" & x"7") else '0'; -- 1-1 0111
isX <= '1' when std_match(unsigned(char), "1-1" & x"8") else '0'; -- 1-1 1000
isY <= '1' when std_match(unsigned(char), "1-1" & x"9") else '0'; -- 1-1 1001
isZ <= '1' when std_match(unsigned(char), "1-1" & x"A") else '0'; -- 1-1 1010
is0 <= '1' when std_match(unsigned(char), "011" & x"0") else '0'; -- 011 0000
is1 <= '1' when std_match(unsigned(char), "011" & x"1") else '0'; -- 011 0001
is2 <= '1' when std_match(unsigned(char), "011" & x"2") else '0'; -- 011 0010
is3 <= '1' when std_match(unsigned(char), "011" & x"3") else '0'; -- 011 0011
is4 <= '1' when std_match(unsigned(char), "011" & x"4") else '0'; -- 011 0100
is5 <= '1' when std_match(unsigned(char), "011" & x"5") else '0'; -- 011 0101
is6 <= '1' when std_match(unsigned(char), "011" & x"6") else '0'; -- 011 0110
is7 <= '1' when std_match(unsigned(char), "011" & x"7") else '0'; -- 011 0111
is8 <= '1' when std_match(unsigned(char), "011" & x"8") else '0'; -- 011 1000
is9 <= '1' when std_match(unsigned(char), "011" & x"9") else '0'; -- 011 1001
process(reset, clock) begin
if reset = '1' then
general_current_state <= waitForChar;
sending_current_state <= waiting;
elsif rising_edge(clock) then
general_current_state <= general_next_state;
sending_current_state <= sending_next_state;
end if;
end process;
process(general_current_state) begin
case general_current_state is
when waitForChar =>
register1 <= END_WORD;
register2 <= END_WORD;
register3 <= END_WORD;
register4 <= END_WORD;
register5 <= END_WORD;
if charNotReady = '0' then
general_next_state <= storeChar;
else
general_next_state <= waitForChar;
end if;
when storeChar =>
if isA then
register1 <= SHORT;
register2 <= LONG;
general_next_state <= sendRegisters;
elsif isB then
register1 <= LONG;
register2 <= SHORT;
register3 <= SHORT;
register4 <= SHORT;
general_next_state <= sendRegisters;
elsif isC then
register1 <= LONG;
register2 <= SHORT;
register3 <= LONG;
register4 <= SHORT;
general_next_state <= sendRegisters;
elsif isD then
register1 <= LONG;
register2 <= SHORT;
register3 <= SHORT;
general_next_state <= sendRegisters;
elsif isE then
register1 <= SHORT;
general_next_state <= sendRegisters;
elsif isF then
register1 <= SHORT;
register2 <= SHORT;
register3 <= LONG;
register4 <= SHORT;
general_next_state <= sendRegisters;
elsif isG then
register1 <= LONG;
register2 <= LONG;
register3 <= SHORT;
general_next_state <= sendRegisters;
elsif isH then
register1 <= SHORT;
register2 <= SHORT;
register3 <= SHORT;
register4 <= SHORT;
general_next_state <= sendRegisters;
elsif isI then
register1 <= SHORT;
register2 <= SHORT;
general_next_state <= sendRegisters;
elsif isJ then
register1 <= SHORT;
register2 <= LONG;
register3 <= LONG;
register4 <= LONG;
general_next_state <= sendRegisters;
elsif isK then
register1 <= LONG;
register2 <= SHORT;
register3 <= LONG;
general_next_state <= sendRegisters;
elsif isL then
register1 <= SHORT;
register2 <= LONG;
register3 <= SHORT;
register4 <= SHORT;
general_next_state <= sendRegisters;
elsif isM then
register1 <= LONG;
register2 <= LONG;
general_next_state <= sendRegisters;
elsif isN then
register1 <= LONG;
register2 <= SHORT;
general_next_state <= sendRegisters;
elsif isO then
register1 <= LONG;
register2 <= LONG;
register3 <= LONG;
general_next_state <= sendRegisters;
elsif isP then
register1 <= SHORT;
register2 <= LONG;
register3 <= LONG;
register4 <= SHORT;
general_next_state <= sendRegisters;
elsif isQ then
register1 <= LONG;
register2 <= LONG;
register3 <= SHORT;
register4 <= LONG;
general_next_state <= sendRegisters;
elsif isR then
register1 <= SHORT;
register2 <= LONG;
register3 <= SHORT;
general_next_state <= sendRegisters;
elsif isS then
register1 <= SHORT;
register2 <= SHORT;
register3 <= SHORT;
general_next_state <= sendRegisters;
elsif isT then
register1 <= LONG;
general_next_state <= sendRegisters;
elsif isU then
register1 <= SHORT;
register2 <= SHORT;
register3 <= LONG;
general_next_state <= sendRegisters;
elsif isV then
register1 <= SHORT;
register2 <= SHORT;
register3 <= SHORT;
register4 <= LONG;
general_next_state <= sendRegisters;
elsif isW then
register1 <= SHORT;
register2 <= LONG;
register3 <= LONG;
general_next_state <= sendRegisters;
elsif isX then
register1 <= LONG;
register2 <= SHORT;
register3 <= SHORT;
register4 <= LONG;
general_next_state <= sendRegisters;
elsif isY then
register1 <= LONG;
register2 <= SHORT;
register3 <= LONG;
register4 <= LONG;
general_next_state <= sendRegisters;
elsif isZ then
register1 <= LONG;
register2 <= LONG;
register3 <= SHORT;
register4 <= SHORT;
general_next_state <= sendRegisters;
elsif is0 then
register1 <= LONG;
register2 <= LONG;
register3 <= LONG;
register4 <= LONG;
register5 <= LONG;
general_next_state <= sendRegisters;
elsif is1 then
register1 <= SHORT;
register2 <= LONG;
register3 <= LONG;
register4 <= LONG;
register5 <= LONG;
general_next_state <= sendRegisters;
elsif is2 then
register1 <= SHORT;
register2 <= SHORT;
register3 <= LONG;
register4 <= LONG;
register5 <= LONG;
general_next_state <= sendRegisters;
elsif is3 then
register1 <= SHORT;
register2 <= SHORT;
register3 <= SHORT;
register4 <= LONG;
register5 <= LONG;
general_next_state <= sendRegisters;
elsif is4 then
register1 <= SHORT;
register2 <= SHORT;
register3 <= SHORT;
register4 <= SHORT;
register5 <= LONG;
general_next_state <= sendRegisters;
elsif is5 then
register1 <= SHORT;
register2 <= SHORT;
register3 <= SHORT;
register4 <= SHORT;
register5 <= SHORT;
general_next_state <= sendRegisters;
elsif is6 then
register1 <= LONG;
register2 <= SHORT;
register3 <= SHORT;
register4 <= SHORT;
register5 <= SHORT;
general_next_state <= sendRegisters;
elsif is7 then
register1 <= LONG;
register2 <= LONG;
register3 <= SHORT;
register4 <= SHORT;
register5 <= SHORT;
general_next_state <= sendRegisters;
elsif is8 then
register1 <= LONG;
register2 <= LONG;
register3 <= LONG;
register4 <= SHORT;
register5 <= SHORT;
general_next_state <= sendRegisters;
elsif is9 then
register1 <= LONG;
register2 <= LONG;
register3 <= LONG;
register4 <= LONG;
register5 <= SHORT;
general_next_state <= sendRegisters;
else
register1 <= END_WORD;
register2 <= END_WORD;
register3 <= END_WORD;
register4 <= END_WORD;
register5 <= END_WORD;
general_next_state <= storeChar;
end if;
when sendRegisters =>
sending_next_state <= sendR1;
when sended =>
register1 <= END_WORD;
register2 <= END_WORD;
register3 <= END_WORD;
register4 <= END_WORD;
register5 <= END_WORD;
WHEN OTHERS =>
general_next_state <= waitForChar;
end case;
end process;
process(sending_current_state) begin
end process;
morseOut <= '0';
startCounter <= '0';

View File

@ -0,0 +1,30 @@
-- VHDL Entity Morse.charToMorse.symbol
--
-- Created:
-- by - axel.amand.UNKNOWN (WE7860)
-- at - 14:49:52 28.04.2023
--
-- Generated by Mentor Graphics' HDL Designer(TM) 2019.2 (Build 5)
--
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
ENTITY charToMorse IS
GENERIC(
characterBitNb : positive := 8;
unitCountDivide : positive := 10E3
);
PORT(
morseOut : OUT std_ulogic;
clock : IN std_ulogic;
reset : IN std_ulogic;
charIn : IN std_ulogic_vector (characterBitNb-1 DOWNTO 0);
readChar : OUT std_ulogic;
charNotReady : IN std_ulogic
);
-- Declarations
END charToMorse ;

View File

@ -0,0 +1,98 @@
--
-- VHDL Architecture Morse.charToMorse.struct
--
-- Created:
-- by - axel.amand.UNKNOWN (WE7860)
-- at - 14:49:52 28.04.2023
--
-- Generated by Mentor Graphics' HDL Designer(TM) 2019.2 (Build 5)
--
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
LIBRARY Morse;
ARCHITECTURE struct OF charToMorse IS
-- Architecture declarations
constant unitCountBitNb: positive := 3;
-- Internal signal declarations
SIGNAL startCounter : std_ulogic;
SIGNAL done : std_ulogic;
SIGNAL unitNb : unsigned(unitCountBitNb-1 DOWNTO 0);
-- Component Declarations
COMPONENT charToMorseController
GENERIC (
characterBitNb : positive := 8;
unitCountBitNb : positive := 3
);
PORT (
morseOut : OUT std_ulogic ;
clock : IN std_ulogic ;
reset : IN std_ulogic ;
charNotReady : IN std_ulogic ;
char : IN std_ulogic_vector (characterBitNb-1 DOWNTO 0);
startCounter : OUT std_ulogic ;
unitNb : OUT unsigned (unitCountBitNb-1 DOWNTO 0);
counterDone : IN std_ulogic ;
readChar : OUT std_ulogic
);
END COMPONENT;
COMPONENT unitCounter
GENERIC (
unitCountDivide : positive := 10E3;
unitCountBitNb : positive := 3
);
PORT (
clock : IN std_ulogic ;
reset : IN std_ulogic ;
startCounter : IN std_ulogic ;
unitNb : IN unsigned (unitCountBitNb-1 DOWNTO 0);
done : OUT std_ulogic
);
END COMPONENT;
-- Optional embedded configurations
-- pragma synthesis_off
FOR ALL : charToMorseController USE ENTITY Morse.charToMorseController;
FOR ALL : unitCounter USE ENTITY Morse.unitCounter;
-- pragma synthesis_on
BEGIN
-- Instance port mappings.
I_ctl : charToMorseController
GENERIC MAP (
characterBitNb => characterBitNb,
unitCountBitNb => unitCountBitNb
)
PORT MAP (
morseOut => morseOut,
clock => clock,
reset => reset,
charNotReady => charNotReady,
char => charIn,
startCounter => startCounter,
unitNb => unitNb,
counterDone => done,
readChar => readChar
);
I_cnt : unitCounter
GENERIC MAP (
unitCountDivide => unitCountDivide,
unitCountBitNb => unitCountBitNb
)
PORT MAP (
clock => clock,
reset => reset,
startCounter => startCounter,
unitNb => unitNb,
done => done
);
END struct;

View File

@ -0,0 +1,33 @@
-- VHDL Entity Morse.charToMorseController.symbol
--
-- Created:
-- by - francois.francois (Aphelia)
-- at - 09:13:01 03/29/19
--
-- Generated by Mentor Graphics' HDL Designer(TM) 2019.2 (Build 5)
--
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
ENTITY charToMorseController IS
GENERIC(
characterBitNb : positive := 8;
unitCountBitNb : positive := 3
);
PORT(
morseOut : OUT std_ulogic;
clock : IN std_ulogic;
reset : IN std_ulogic;
charNotReady : IN std_ulogic;
char : IN std_ulogic_vector (characterBitNb-1 DOWNTO 0);
startCounter : OUT std_ulogic;
unitNb : OUT unsigned (unitCountBitNb-1 DOWNTO 0);
counterDone : IN std_ulogic;
readChar : OUT std_ulogic
);
-- Declarations
END charToMorseController ;

View File

@ -0,0 +1,234 @@
--
-- VHDL Architecture Morse.charToMorseController.fsm
--
-- Created:
-- by - axel.amand.UNKNOWN (WE7860)
-- at - 14:50:02 28.04.2023
--
-- Generated by Mentor Graphics' HDL Designer(TM) 2019.2 (Build 5)
--
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
ARCHITECTURE fsm OF charToMorseController IS
TYPE STATE_TYPE IS (
waitForChar,
storeChar,
sendDotStart,
sendDotWait,
sendDotSpacerStart,
sendDotSpacerWait,
sendDotDotStart,
sendDotDotWait,
sendDotDashStart,
sendDotDashWait,
sendDashStart,
sendDashWait,
sendDahsSpacerStart,
sendDashSpacerWait,
sendDashDotStart,
sendDashDashStart,
sendDashDotWait,
sendDashDashWait,
popChar,
popChar1
);
-- Declare current and next state signals
SIGNAL current_state : STATE_TYPE;
SIGNAL next_state : STATE_TYPE;
BEGIN
-----------------------------------------------------------------
clocked_proc : PROCESS (
clock,
reset
)
-----------------------------------------------------------------
BEGIN
IF (reset = '1') THEN
current_state <= waitForChar;
ELSIF (clock'EVENT AND clock = '1') THEN
current_state <= next_state;
END IF;
END PROCESS clocked_proc;
-----------------------------------------------------------------
nextstate_proc : PROCESS (
char,
charNotReady,
counterDone,
current_state
)
-----------------------------------------------------------------
BEGIN
CASE current_state IS
WHEN waitForChar =>
IF (charNotReady = '0') THEN
next_state <= storeChar;
ELSE
next_state <= waitForChar;
END IF;
WHEN storeChar =>
IF (character'val(to_integer(unsigned(char))) = 'e' or
character'val(to_integer(unsigned(char))) = 'i' or
character'val(to_integer(unsigned(char))) = 'a') THEN
next_state <= sendDotStart;
ELSIF (character'val(to_integer(unsigned(char))) = 't' or
character'val(to_integer(unsigned(char))) = 'n' or
character'val(to_integer(unsigned(char))) = 'm') THEN
next_state <= sendDashStart;
ELSE
next_state <= popChar1;
END IF;
WHEN sendDotStart =>
next_state <= sendDotWait;
WHEN sendDotWait =>
IF (counterDone = '0') THEN
next_state <= sendDotWait;
ELSIF (character'val(to_integer(unsigned(char))) = 'e') THEN
next_state <= popChar1;
ELSE
next_state <= sendDotSpacerStart;
END IF;
WHEN sendDotSpacerStart =>
next_state <= sendDotSpacerWait;
WHEN sendDotSpacerWait =>
IF (counterDone = '0') THEN
next_state <= sendDotSpacerWait;
ELSIF (character'val(to_integer(unsigned(char))) = 'i') THEN
next_state <= sendDotDotStart;
ELSE
next_state <= sendDotDashStart;
END IF;
WHEN sendDotDotStart =>
next_state <= sendDotDotWait;
WHEN sendDotDotWait =>
IF (counterDone = '0') THEN
next_state <= sendDotDotWait;
ELSE
next_state <= popChar1;
END IF;
WHEN sendDotDashStart =>
next_state <= sendDotDashWait;
WHEN sendDotDashWait =>
IF (counterDone = '0') THEN
next_state <= sendDotDashWait;
ELSE
next_state <= popChar1;
END IF;
WHEN sendDashStart =>
next_state <= sendDashWait;
WHEN sendDashWait =>
IF (counterDone = '0') THEN
next_state <= sendDashWait;
ELSIF (character'val(to_integer(unsigned(char))) = 't') THEN
next_state <= popChar1;
ELSE
next_state <= sendDahsSpacerStart;
END IF;
WHEN sendDahsSpacerStart =>
next_state <= sendDashSpacerWait;
WHEN sendDashSpacerWait =>
IF (counterDone = '0') THEN
next_state <= sendDashSpacerWait;
ELSIF (character'val(to_integer(unsigned(char))) = 'i') THEN
next_state <= sendDashDotStart;
ELSE
next_state <= sendDashDashStart;
END IF;
WHEN sendDashDotStart =>
next_state <= sendDashDotWait;
WHEN sendDashDashStart =>
next_state <= sendDashDashWait;
WHEN sendDashDotWait =>
IF (counterDone = '0') THEN
next_state <= sendDashDotWait;
ELSE
next_state <= popChar1;
END IF;
WHEN sendDashDashWait =>
IF (counterDone = '0') THEN
next_state <= sendDashDashWait;
ELSE
next_state <= popChar1;
END IF;
WHEN popChar =>
IF (counterDone = '1') THEN
next_state <= waitForChar;
ELSE
next_state <= popChar;
END IF;
WHEN popChar1 =>
next_state <= popChar;
WHEN OTHERS =>
next_state <= waitForChar;
END CASE;
END PROCESS nextstate_proc;
-----------------------------------------------------------------
output_proc : PROCESS (
current_state
)
-----------------------------------------------------------------
BEGIN
-- Default Assignment
morseOut <= '0';
startCounter <= '0';
unitNb <= (others => '0');
readChar <= '0';
-- Combined Actions
CASE current_state IS
WHEN sendDotStart =>
startCounter <= '1';
WHEN sendDotWait =>
unitNb <= to_unsigned(1, unitNb'length);
morseOut <= '1';
WHEN sendDotSpacerStart =>
startCounter <= '1';
WHEN sendDotSpacerWait =>
unitNb <= to_unsigned(1, unitNb'length);
WHEN sendDotDotStart =>
startCounter <= '1';
WHEN sendDotDotWait =>
unitNb <= to_unsigned(1, unitNb'length);
morseOut <= '1';
WHEN sendDotDashStart =>
startCounter <= '1';
WHEN sendDotDashWait =>
unitNb <= to_unsigned(3, unitNb'length);
morseOut <= '1';
WHEN sendDashStart =>
startCounter <= '1';
WHEN sendDashWait =>
unitNb <= to_unsigned(3, unitNb'length);
morseOut <= '1';
WHEN sendDahsSpacerStart =>
startCounter <= '1';
WHEN sendDashSpacerWait =>
unitNb <= to_unsigned(1, unitNb'length);
WHEN sendDashDotStart =>
startCounter <= '1';
WHEN sendDashDashStart =>
startCounter <= '1';
WHEN sendDashDotWait =>
unitNb <= to_unsigned(1, unitNb'length);
morseOut <= '1';
WHEN sendDashDashWait =>
unitNb <= to_unsigned(3, unitNb'length);
morseOut <= '1';
WHEN popChar =>
unitNb <= to_unsigned(3, unitNb'length);
WHEN popChar1 =>
readChar <= '1';
startCounter <= '1';
WHEN OTHERS =>
NULL;
END CASE;
END PROCESS output_proc;
END fsm;

View File

@ -0,0 +1,31 @@
-- VHDL Entity Morse.morseEncoder.symbol
--
-- Created:
-- by - francois.francois (Aphelia)
-- at - 09:13:01 03/29/19
--
-- Generated by Mentor Graphics' HDL Designer(TM) 2019.2 (Build 5)
--
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
ENTITY morseEncoder IS
GENERIC(
clockFrequency : real := 100.0E6;
uartBaudRate : real := 115.2E3;
uartDataBitNb : positive := 8;
unitDuration : real := 100.0E-3;
toneFrequency : real := 300.0
);
PORT(
morseCode : OUT std_ulogic;
clock : IN std_ulogic;
reset : IN std_ulogic;
RxD : IN std_ulogic
);
-- Declarations
END morseEncoder ;

View File

@ -0,0 +1,154 @@
--
-- VHDL Architecture Morse.morseEncoder.struct
--
-- Created:
-- by - axel.amand.UNKNOWN (WE7860)
-- at - 14:50:20 28.04.2023
--
-- Generated by Mentor Graphics' HDL Designer(TM) 2019.2 (Build 5)
--
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
LIBRARY Memory;
LIBRARY Morse;
LIBRARY RS232;
ARCHITECTURE struct OF morseEncoder IS
-- Architecture declarations
constant fifoDepth : positive := 100;
-- Internal signal declarations
SIGNAL characterReg : std_ulogic_vector(uartDataBitNb-1 DOWNTO 0);
SIGNAL characterIn : std_ulogic_vector(uartDataBitNb-1 DOWNTO 0);
SIGNAL characterValid : std_ulogic;
SIGNAL morseOut : std_ulogic;
SIGNAL tone : std_ulogic;
SIGNAL charNotReady : std_ulogic;
SIGNAL readChar : std_ulogic;
-- Component Declarations
COMPONENT FIFO_bram
GENERIC (
dataBitNb : positive := 8;
depth : positive := 8
);
PORT (
write : IN std_ulogic ;
clock : IN std_ulogic ;
reset : IN std_ulogic ;
dataOut : OUT std_ulogic_vector (dataBitNb-1 DOWNTO 0);
read : IN std_ulogic ;
dataIn : IN std_ulogic_vector (dataBitNb-1 DOWNTO 0);
empty : OUT std_ulogic ;
full : OUT std_ulogic
);
END COMPONENT;
COMPONENT charToMorse
GENERIC (
characterBitNb : positive := 8;
unitCountDivide : positive := 10E3
);
PORT (
morseOut : OUT std_ulogic ;
clock : IN std_ulogic ;
reset : IN std_ulogic ;
charIn : IN std_ulogic_vector (characterBitNb-1 DOWNTO 0);
readChar : OUT std_ulogic ;
charNotReady : IN std_ulogic
);
END COMPONENT;
COMPONENT toneGenerator
GENERIC (
toneDivide : positive := 100E3
);
PORT (
tone : OUT std_ulogic ;
clock : IN std_ulogic ;
reset : IN std_ulogic
);
END COMPONENT;
COMPONENT serialPortReceiver
GENERIC (
dataBitNb : positive := 8;
baudRateDivide : positive := 2083
);
PORT (
RxD : IN std_ulogic ;
clock : IN std_ulogic ;
reset : IN std_ulogic ;
dataOut : OUT std_ulogic_vector (dataBitNb-1 DOWNTO 0);
dataValid : OUT std_ulogic
);
END COMPONENT;
-- Optional embedded configurations
-- pragma synthesis_off
FOR ALL : FIFO_bram USE ENTITY Memory.FIFO_bram;
FOR ALL : charToMorse USE ENTITY Morse.charToMorse;
FOR ALL : serialPortReceiver USE ENTITY RS232.serialPortReceiver;
FOR ALL : toneGenerator USE ENTITY Morse.toneGenerator;
-- pragma synthesis_on
BEGIN
-- Architecture concurrent statements
-- HDL Embedded Text Block 1 eb1
morseCode <= morseOut and tone;
-- Instance port mappings.
I_FIFO : FIFO_bram
GENERIC MAP (
dataBitNb => uartDataBitNb,
depth => fifoDepth
)
PORT MAP (
write => characterValid,
clock => clock,
reset => reset,
dataOut => characterReg,
read => readChar,
dataIn => characterIn,
empty => charNotReady,
full => OPEN
);
I_enc : charToMorse
GENERIC MAP (
characterBitNb => uartDataBitNb,
unitCountDivide => integer(clockFrequency*unitDuration + 0.5)
)
PORT MAP (
morseOut => morseOut,
clock => clock,
reset => reset,
charNotReady => charNotReady,
charIn => characterReg,
readChar => readChar
);
I_tone : toneGenerator
GENERIC MAP (
toneDivide => integer(clockFrequency/toneFrequency + 0.5)
)
PORT MAP (
tone => tone,
clock => clock,
reset => reset
);
I_UART : serialPortReceiver
GENERIC MAP (
dataBitNb => uartDataBitNb,
baudRateDivide => integer(clockFrequency/uartBaudRate + 0.5)
)
PORT MAP (
RxD => RxD,
clock => clock,
reset => reset,
dataOut => characterIn,
dataValid => characterValid
);
END struct;

View File

@ -0,0 +1,26 @@
-- VHDL Entity Morse.toneGenerator.symbol
--
-- Created:
-- by - francois.francois (Aphelia)
-- at - 09:13:01 03/29/19
--
-- Generated by Mentor Graphics' HDL Designer(TM) 2019.2 (Build 5)
--
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
ENTITY toneGenerator IS
GENERIC(
toneDivide : positive := 100E3
);
PORT(
tone : OUT std_ulogic;
clock : IN std_ulogic;
reset : IN std_ulogic
);
-- Declarations
END toneGenerator ;

View File

@ -0,0 +1,29 @@
-- VHDL Entity Morse.unitCounter.symbol
--
-- Created:
-- by - francois.francois (Aphelia)
-- at - 09:13:01 03/29/19
--
-- Generated by Mentor Graphics' HDL Designer(TM) 2019.2 (Build 5)
--
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
ENTITY unitCounter IS
GENERIC(
unitCountDivide : positive := 10E3;
unitCountBitNb : positive := 3
);
PORT(
clock : IN std_ulogic;
reset : IN std_ulogic;
startCounter : IN std_ulogic;
unitNb : IN unsigned (unitCountBitNb-1 DOWNTO 0);
done : OUT std_ulogic
);
-- Declarations
END unitCounter ;