SHARE
TWEET

Untitled

a guest Jun 19th, 2017 44 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. library ieee;
  2. use ieee.std_logic_1164.all;
  3. use ieee.std_logic_arith.all;
  4. use ieee.std_logic_unsigned.all;
  5.  
  6. entity address_decoder is
  7.     Port (
  8.         a11 : In std_logic;
  9.         a10 : In std_logic;
  10.         a9  : In std_logic;
  11.         a8  : In std_logic;
  12.         rd  : In std_logic;
  13.         wr  : In std_logic;
  14.        
  15.        
  16.         cs_ram : Out std_logic;
  17.         cs_adc : Out std_logic;
  18.         lcd_en : Out std_logic;
  19.         lcd_rw : Out std_logic;
  20.         lcd_rs : Out std_logic
  21.        
  22.     );
  23.     attribute LOC : string;
  24.     attribute LOC of cs_adc : signal is "P19";
  25.     attribute LOC of lcd_en : signal is "P18";
  26.     attribute LOC of lcd_rw : signal is "P17";
  27.     attribute LOC of lcd_rs : signal is "P16";
  28.     attribute LOC of cs_ram : signal is "P15";
  29.     attribute LOC of rd   : signal is "P5";
  30.     attribute LOC of wr   : signal is "P6";
  31.     attribute LOC of a11  : signal is "P7";
  32.     attribute LOC of a10  : signal is "P8";
  33.     attribute LOC of a9   : signal is "P9";
  34.     attribute LOC of a8   : signal is "P4";
  35. end address_decoder;
  36.  
  37. architecture behave of address_decoder is begin
  38.     -- implement the functionality here
  39.    
  40.     -- hvis a11 (el a8?) = 1, skal cs_ram gå lav
  41.     --cs_ram <= a11;
  42.     cs_ram <= NOT (a11);
  43.    
  44.     --hvis a11 = 0 og a10 = 1, skal cs_adc gå lav
  45.     cs_adc <= NOT( NOT(a11) AND a10 );
  46.    
  47.     --LCD a11-a10-a9-a8
  48.     lcd_rw <= a8 AND ( NOT(a11) AND NOT(a10) );
  49.     lcd_rs <= a9 AND ( NOT(a11) AND NOT(a10) );
  50.     lcd_en <= NOT((NOT a11 AND NOT a10) AND NOT(wr AND rd));
  51.     --lcd_en <= (a11 NOR a10) AND (wr XOR rd);
  52.     --lcd_en <= ((wr NAND rd) NAND ( (NOT(a11)) AND (NOT(a10)) ) ) NAND ((wr NAND rd) NAND ( (NOT(a11)) AND (NOT(a10)) ));
  53.     --lcd_en <= (wr NAND rd) AND ( (NOT(a11)) AND (NOT(a10)) );
  54. end behave;
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top