OpenCores
URL https://opencores.org/ocsvn/open8_urisc/open8_urisc/trunk

Subversion Repositories open8_urisc

[/] [open8_urisc/] [trunk/] [VHDL/] [o8_hd44780_8b.vhd] - Diff between revs 189 and 191

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 189 Rev 191
Line 50... Line 50...
architecture behave of o8_hd44780_8b is
architecture behave of o8_hd44780_8b is
 
 
  constant User_Addr    : std_logic_vector(15 downto 2)
  constant User_Addr    : std_logic_vector(15 downto 2)
                          := Address(15 downto 2);
                          := Address(15 downto 2);
  alias  Comp_Addr      is Bus_Address(15 downto 2);
  alias  Comp_Addr      is Bus_Address(15 downto 2);
  signal Addr_Match     : std_logic;
  signal Addr_Match     : std_logic := '0';
 
 
  alias  Reg_Addr        is Bus_Address(1 downto 0);
  alias  Reg_Addr        is Bus_Address(1 downto 0);
  signal Reg_Addr_q     : std_logic_vector(1 downto 0);
  signal Reg_Addr_q     : std_logic_vector(1 downto 0) := (others => '0');
 
 
  signal Wr_En          : std_logic;
  signal Wr_En          : std_logic := '0';
  signal Wr_Data_q      : DATA_TYPE;
  signal Wr_Data_q      : DATA_TYPE := x"00";
  signal Rd_En          : std_logic;
  signal Rd_En          : std_logic := '0';
 
 
  signal Reg_Valid      : std_logic;
  signal Reg_Valid      : std_logic := '0';
  signal Reg_Sel        : std_logic;
  signal Reg_Sel        : std_logic := '0';
  signal Reg_Data       : std_logic_vector(7 downto 0);
  signal Reg_Data       : DATA_TYPE := x"00";
 
 
  signal Tx_Ready       : std_logic;
  signal Tx_Ready       : std_logic;
 
 
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- LCD Controller
-- LCD Controller
Line 108... Line 108...
  constant LCD_CONFIG3  : std_logic_vector(7 downto 0) := x"01"; -- Clear display
  constant LCD_CONFIG3  : std_logic_vector(7 downto 0) := x"01"; -- Clear display
  constant LCD_CONFIG4  : std_logic_vector(7 downto 0) := x"06"; -- Positive increment, no shift
  constant LCD_CONFIG4  : std_logic_vector(7 downto 0) := x"06"; -- Positive increment, no shift
  constant LCD_CONFIG5  : std_logic_vector(7 downto 0) := x"2A"; -- Print a "*"
  constant LCD_CONFIG5  : std_logic_vector(7 downto 0) := x"2A"; -- Print a "*"
  constant LCD_CONFIG6  : std_logic_vector(7 downto 0) := x"02"; -- Reset the cursor
  constant LCD_CONFIG6  : std_logic_vector(7 downto 0) := x"02"; -- Reset the cursor
 
 
  signal init_count     : std_logic_vector(2 downto 0);
  signal init_count     : std_logic_vector(2 downto 0) := (others => '0');
 
 
  constant INIT_40MS    : integer := 40000;
  constant INIT_40MS    : integer := 40000;
  constant INIT_BITS    : integer := ceil_log2(INIT_40MS);
  constant INIT_BITS    : integer := ceil_log2(INIT_40MS);
  constant INIT_DELAY   : std_logic_vector(INIT_BITS-1 downto 0) :=
  constant INIT_DELAY   : std_logic_vector(INIT_BITS-1 downto 0) :=
                          conv_std_logic_vector(INIT_40MS,INIT_BITS);
                          conv_std_logic_vector(INIT_40MS,INIT_BITS);
Line 127... Line 127...
 --  most instructions completing in 37uS. No clue as to why, but it works
 --  most instructions completing in 37uS. No clue as to why, but it works
  constant BUSY_50US    : integer := 50;
  constant BUSY_50US    : integer := 50;
  constant BUSY_DELAY   : std_logic_vector(INIT_BITS-1 downto 0) :=
  constant BUSY_DELAY   : std_logic_vector(INIT_BITS-1 downto 0) :=
                          conv_std_logic_vector(BUSY_50US-1, INIT_BITS);
                          conv_std_logic_vector(BUSY_50US-1, INIT_BITS);
 
 
  signal busy_timer     : std_logic_vector(INIT_BITS-1 downto 0);
  signal busy_timer     : std_logic_vector(INIT_BITS-1 downto 0) := (others => '0');
 
 
  constant SNH_600NS    : integer := integer(Sys_Freq * 0.000000600);
  constant SNH_600NS    : integer := integer(Sys_Freq * 0.000000600);
  constant SNH_BITS     : integer := ceil_log2(SNH_600NS);
  constant SNH_BITS     : integer := ceil_log2(SNH_600NS);
  constant SNH_DELAY    : std_logic_vector(SNH_BITS-1 downto 0) :=
  constant SNH_DELAY    : std_logic_vector(SNH_BITS-1 downto 0) :=
                          conv_std_logic_vector(SNH_600NS-1, SNH_BITS);
                          conv_std_logic_vector(SNH_600NS-1, SNH_BITS);
 
 
  signal io_timer       : std_logic_vector(SNH_BITS - 1 downto 0);
  signal io_timer       : std_logic_vector(SNH_BITS - 1 downto 0) := (others => '0');
 
 
  type IO_STATES is (INIT, FN_JUMP, IDLE,
  type IO_STATES is (INIT, FN_JUMP, IDLE,
                     WR_PREP, WR_SETUP, WR_HOLD,
                     WR_PREP, WR_SETUP, WR_HOLD,
                     BUSY_PREP, BUSY_WAIT,
                     BUSY_PREP, BUSY_WAIT,
                     ISSUE_INT );
                     ISSUE_INT );
  signal io_state       : IO_STATES;
  signal io_state       : IO_STATES;
 
 
  signal LCD_Data       : std_logic_vector(7 downto 0);
  signal LCD_Data       : std_logic_vector(7 downto 0) := x"00";
  signal LCD_Addr       : std_logic;
  signal LCD_Addr       : std_logic := '0';
 
 
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Backlight & Contrast signals
-- Backlight & Contrast signals
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
 
 
Line 198... Line 198...
  constant PADJ_6       : std_logic_vector(DIV_WIDTH-1 downto 0) :=
  constant PADJ_6       : std_logic_vector(DIV_WIDTH-1 downto 0) :=
                           conv_std_logic_vector(PADJ_6_I,DIV_WIDTH);
                           conv_std_logic_vector(PADJ_6_I,DIV_WIDTH);
 
 
  constant CB           : integer := ceil_log2(DIV_WIDTH);
  constant CB           : integer := ceil_log2(DIV_WIDTH);
 
 
  signal LCD_Contrast   : std_logic_vector(7 downto 0);
  signal LCD_Contrast   : std_logic_vector(7 downto 0) := x"00";
 
 
  signal CN_DACin_q     : std_logic_vector(DAC_WIDTH-1 downto 0);
  signal CN_DACin_q     : std_logic_vector(DAC_WIDTH-1 downto 0) := (others => '0');
 
 
  signal CN_Divisor     : std_logic_vector(DIV_WIDTH-1 downto 0);
  signal CN_Divisor     : std_logic_vector(DIV_WIDTH-1 downto 0) := (others => '0');
  signal CN_Dividend    : std_logic_vector(DIV_WIDTH-1 downto 0);
  signal CN_Dividend    : std_logic_vector(DIV_WIDTH-1 downto 0) := (others => '0');
 
 
  signal CN_q           : std_logic_vector(DIV_WIDTH*2-1 downto 0);
  signal CN_q           : std_logic_vector(DIV_WIDTH*2-1 downto 0) := (others => '0');
  signal CN_diff        : std_logic_vector(DIV_WIDTH downto 0);
  signal CN_diff        : std_logic_vector(DIV_WIDTH downto 0) := (others => '0');
 
 
  signal CN_count       : std_logic_vector(CB-1 downto 0);
  signal CN_count       : std_logic_vector(CB-1 downto 0) := (others => '0');
 
 
  signal CN_Next_Wdt    : std_logic_vector(DAC_Width-1 downto 0);
  signal CN_Next_Wdt    : std_logic_vector(DAC_Width-1 downto 0) := (others => '0');
  signal CN_Next_Per    : std_logic_vector(DAC_Width-1 downto 0);
  signal CN_Next_Per    : std_logic_vector(DAC_Width-1 downto 0) := (others => '0');
 
 
  signal CN_PWM_Wdt     : std_logic_vector(DAC_Width-1 downto 0);
  signal CN_PWM_Wdt     : std_logic_vector(DAC_Width-1 downto 0) := (others => '0');
  signal CN_PWM_Per     : std_logic_vector(DAC_Width-1 downto 0);
  signal CN_PWM_Per     : std_logic_vector(DAC_Width-1 downto 0) := (others => '0');
 
 
  signal CN_Wdt_Ctr     : std_logic_vector(DAC_Width-1 downto 0);
  signal CN_Wdt_Ctr     : std_logic_vector(DAC_Width-1 downto 0) := (others => '0');
  signal CN_Per_Ctr     : std_logic_vector(DAC_Width-1 downto 0);
  signal CN_Per_Ctr     : std_logic_vector(DAC_Width-1 downto 0) := (others => '0');
 
 
  signal LCD_Bright     : std_logic_vector(7 downto 0);
  signal LCD_Bright     : std_logic_vector(7 downto 0) := (others => '0');
 
 
  signal BL_DACin_q     : std_logic_vector(DAC_WIDTH-1 downto 0);
  signal BL_DACin_q     : std_logic_vector(DAC_WIDTH-1 downto 0) := (others => '0');
 
 
  signal BL_Divisor     : std_logic_vector(DIV_WIDTH-1 downto 0);
  signal BL_Divisor     : std_logic_vector(DIV_WIDTH-1 downto 0) := (others => '0');
  signal BL_Dividend    : std_logic_vector(DIV_WIDTH-1 downto 0);
  signal BL_Dividend    : std_logic_vector(DIV_WIDTH-1 downto 0) := (others => '0');
 
 
  signal BL_q           : std_logic_vector(DIV_WIDTH*2-1 downto 0);
  signal BL_q           : std_logic_vector(DIV_WIDTH*2-1 downto 0) := (others => '0');
  signal BL_diff        : std_logic_vector(DIV_WIDTH downto 0);
  signal BL_diff        : std_logic_vector(DIV_WIDTH downto 0) := (others => '0');
 
 
  signal BL_count       : std_logic_vector(CB-1 downto 0);
  signal BL_count       : std_logic_vector(CB-1 downto 0) := (others => '0');
 
 
  signal BL_Next_Wdt    : std_logic_vector(DAC_Width-1 downto 0);
  signal BL_Next_Wdt    : std_logic_vector(DAC_Width-1 downto 0) := (others => '0');
  signal BL_Next_Per    : std_logic_vector(DAC_Width-1 downto 0);
  signal BL_Next_Per    : std_logic_vector(DAC_Width-1 downto 0) := (others => '0');
 
 
  signal BL_PWM_Wdt     : std_logic_vector(DAC_Width-1 downto 0);
  signal BL_PWM_Wdt     : std_logic_vector(DAC_Width-1 downto 0) := (others => '0');
  signal BL_PWM_Per     : std_logic_vector(DAC_Width-1 downto 0);
  signal BL_PWM_Per     : std_logic_vector(DAC_Width-1 downto 0) := (others => '0');
 
 
  signal BL_Wdt_Ctr     : std_logic_vector(DAC_Width-1 downto 0);
  signal BL_Wdt_Ctr     : std_logic_vector(DAC_Width-1 downto 0) := (others => '0');
  signal BL_Per_Ctr     : std_logic_vector(DAC_Width-1 downto 0);
  signal BL_Per_Ctr     : std_logic_vector(DAC_Width-1 downto 0) := (others => '0');
 
 
begin
begin
 
 
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Open8 Register interface
-- Open8 Register interface
Line 255... Line 255...
    if( Reset = Reset_Level )then
    if( Reset = Reset_Level )then
      Reg_Addr_q        <= (others => '0');
      Reg_Addr_q        <= (others => '0');
      Wr_Data_q         <= (others => '0');
      Wr_Data_q         <= (others => '0');
      Wr_En             <= '0';
      Wr_En             <= '0';
      Rd_En             <= '0';
      Rd_En             <= '0';
      Rd_Data           <= (others => '0');
      Rd_Data           <= OPEN8_NULLBUS;
 
 
      Reg_Valid         <= '0';
      Reg_Valid         <= '0';
      Reg_Sel           <= '0';
      Reg_Sel           <= '0';
      Reg_Data          <= x"00";
      Reg_Data          <= x"00";
 
 
Line 285... Line 285...
            LCD_Bright  <= Wr_Data_q;
            LCD_Bright  <= Wr_Data_q;
          when others => null;
          when others => null;
        end case;
        end case;
      end if;
      end if;
 
 
      Rd_Data           <= (others => '0');
      Rd_Data           <= OPEN8_NULLBUS;
      Rd_En             <= Addr_Match and Rd_Enable;
      Rd_En             <= Addr_Match and Rd_Enable;
      if( Rd_En = '1' )then
      if( Rd_En = '1' )then
        case( Reg_Addr_q )is
        case( Reg_Addr_q )is
          when "00" | "01" =>
          when "00" | "01" =>
            Rd_Data(7)  <= Tx_Ready;
            Rd_Data(7)  <= Tx_Ready;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.