Hardware Reference
In-Depth Information
these pairs of values are the values expected to be seen on the display (during
0.5 s each).
Observe the correct use of registers and the completeness of the code, as described
in comment 10 of section 6.3.
The reader is invited to set up this (or an equivalent) experiment and play with it
in the FPGA board.
1 --Packagewithfunction"hex_to_ssd":--------------------------------------
2 library ieee;
3 use ieee.std_logic_1164.all;
4 package my_functions is
5 function hex_to_ssd(input:std_logic_vector) return std_logic_vector;
6 end my_functions;
7 ---------------------------------------------------------------------------
8 package body my_functions is
9 function hex_to_ssd(input: std_logic_vector) return std_logic_vector is
10 begin
11 case input is
12 when "0000" => return "0000001"; --"0" on SSD
13 when "0001" => return "1001111"; --"1" on SSD
14 when "0010" => return "0010010"; --"2" on SSD
15 when "0011" => return "0000110"; --"3" on SSD
16 when "0100" => return "1001100"; --"4" on SSD
17 when "0101" => return "0100100"; --"5" on SSD
18 when "0110" => return "0100000"; --"6" on SSD
19 when "0111" => return "0001111"; --"7" on SSD
20 when "1000" => return "0000000"; --"8" on SSD
21 when "1001" => return "0000100"; --"9" on SSD
22 when "1010" => return "0001000"; --"A" on SSD
23 when "1011" => return "1100000"; --"b" on SSD
24 when "1100" => return "0110001"; --"C" on SSD
25 when "1101" => return "1000010"; --"d" on SSD
26 when "1110" => return "0110000"; --"E" on SSD
27 when "1111" => return "0111000"; --"F" on SSD
28 when others => return "1111110"; --"-" on SSD
29 end case;
30 end hex_to_ssd;
31 end package body;
32 ---------------------------------------------------------------------------
1 --Maincode:---------------------------------------------------------------
2 library ieee;
3 use ieee.std_logic_1164.all;
4 use work.my_functions.all; --package with “hex_to_ssd” function
5 ---------------------------------------------------------------------------
6 entity FRAM_with_SPI_bus is
7
generic (
8
--Device's SPI parameters:
9
WREN_opcode: std_logic_vector(7 downto 0) := "00000110";
10
WRITE_opcode: std_logic_vector(7 downto 0) := "00000010";
Search WWH ::




Custom Search