Initial commit
This commit is contained in:
		
							
								
								
									
										28
									
								
								05-Morse/Morse/hdl/toneGenerator_studentVersion.vhd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								05-Morse/Morse/hdl/toneGenerator_studentVersion.vhd
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| library Common; | ||||
|   use Common.CommonLib.all; | ||||
|  | ||||
| ARCHITECTURE studentVersion OF toneGenerator IS | ||||
|  | ||||
|   constant toneCounterBitNb: positive := requiredBitNb(toneDivide-1); | ||||
|   signal toneCounter: unsigned(toneCounterBitNb-1 downto 0); | ||||
|   constant toneMin : natural := (2**toneCounterBitNb - toneDivide) / 2; | ||||
|   constant toneMax : natural := toneMin + toneDivide; | ||||
|  | ||||
| BEGIN | ||||
|  | ||||
|   divide: process(reset, clock) | ||||
|   begin | ||||
|     if reset = '1' then | ||||
|       toneCounter <= to_unsigned(toneMin, toneCounter'length); | ||||
|     elsif rising_edge(clock) then | ||||
|       if toneCounter = toneMax then | ||||
|         toneCounter <= to_unsigned(toneMin, toneCounter'length); | ||||
|       else | ||||
|         toneCounter <= toneCounter + 1; | ||||
|       end if; | ||||
|     end if; | ||||
|   end process divide; | ||||
|  | ||||
|   tone <= toneCounter(toneCounter'high); | ||||
|  | ||||
| END ARCHITECTURE studentVersion; | ||||
		Reference in New Issue
	
	Block a user