Line 1... |
Line 1... |
|
-------------------------------------------------------------------------------
|
|
--
|
|
-- Design: tinyVLIW8 soft-core processor
|
|
-- Author: Oliver Stecklina <stecklina@ihp-microelectronics.com>
|
|
-- Date: 24.10.2013
|
|
-- File: sysArch.vhd
|
|
--
|
|
-------------------------------------------------------------------------------
|
|
--
|
|
-- Description : TinyVLIW8 system architecture includes processor core and
|
|
-- GPIO, timer, and SPI periperals
|
|
--
|
|
-------------------------------------------------------------------------------
|
|
--
|
|
-- Copyright (C) 2015 IHP GmbH, Frankfurt (Oder), Germany
|
|
--
|
|
-- This code is free software. It is licensed under the EUPL, Version 1.1
|
|
-- or - as soon they will be approved by the European Commission - subsequent
|
|
-- versions of the EUPL (the "License").
|
|
-- You may redistribute this code and/or modify it under the terms of this
|
|
-- License.
|
|
-- You may not use this work except in compliance with the License.
|
|
-- You may obtain a copy of the License at:
|
|
--
|
|
-- http://joinup.ec.europa.eu/software/page/eupl/licence-eupl
|
|
--
|
|
-- Unless required by applicable law or agreed to in writing, software
|
|
-- distributed under the License is distributed on an "AS IS" basis,
|
|
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
-- See the License for the specific language governing permissions and
|
|
-- limitations under the License.
|
|
--
|
|
-------------------------------------------------------------------------------
|
|
|
library ieee;
|
library ieee;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_1164.all;
|
use ieee.std_logic_arith.all;
|
use ieee.std_logic_arith.all;
|
|
|
entity sysArch is
|
entity sysArch is
|
Line 23... |
Line 57... |
ioDataIn : in std_logic_vector(7 downto 0);
|
ioDataIn : in std_logic_vector(7 downto 0);
|
ioDataOut : out std_logic_vector(7 downto 0);
|
ioDataOut : out std_logic_vector(7 downto 0);
|
ioWrEn_n : out std_logic;
|
ioWrEn_n : out std_logic;
|
ioRdEn_n : out std_logic;
|
ioRdEn_n : out std_logic;
|
|
|
-- interrupt handling
|
-- external interrupt handling
|
irqLine : in std_logic;
|
irqLine : in std_logic;
|
irqLineAck : out std_logic;
|
irqLineAck : out std_logic;
|
|
|
-- general purpose IO
|
-- general purpose IO
|
gpio_in : in std_logic_vector(7 downto 0);
|
gpio_in : in std_logic_vector(7 downto 0);
|
Line 67... |
Line 101... |
MOSI : OUT STD_LOGIC; -- SPI master output, slave input
|
MOSI : OUT STD_LOGIC; -- SPI master output, slave input
|
MISO : IN STD_LOGIC -- SPI master input, slave output
|
MISO : IN STD_LOGIC -- SPI master input, slave output
|
);
|
);
|
END component;
|
END component;
|
|
|
component sha1_ex
|
|
PORT(
|
|
resetn : IN STD_LOGIC; -- reset the module (low active)
|
|
clk : IN STD_LOGIC; -- clock of the sha1
|
|
cen : IN STD_LOGIC; -- IO select low active
|
|
wen : in std_logic; --- write enable low active
|
|
addr : IN STD_LOGIC_VECTOR(1 DOWNTO 0); -- address signal
|
|
d_in : IN STD_LOGIC_VECTOR(7 DOWNTO 0); -- data
|
|
intr : OUT STD_LOGIC; -- signalizes if generation finished
|
|
intra : IN STD_LOGIC; -- signalizes if generation finished
|
|
d_out : out STD_LOGIC_VECTOR(7 DOWNTO 0) -- data
|
|
);
|
|
end component;
|
|
|
|
component vliwProc
|
component vliwProc
|
port (
|
port (
|
clk : in std_logic;
|
clk : in std_logic;
|
|
|
instMemAddr : out std_logic_vector(10 downto 0);
|
instMemAddr : out std_logic_vector(10 downto 0);
|
Line 198... |
Line 218... |
-- spi master signals
|
-- spi master signals
|
signal ioSpiEn_n_s : std_logic;
|
signal ioSpiEn_n_s : std_logic;
|
signal spiIrq_s : std_logic;
|
signal spiIrq_s : std_logic;
|
signal ioDataSpi_s : std_logic_vector(7 downto 0);
|
signal ioDataSpi_s : std_logic_vector(7 downto 0);
|
|
|
-- sha1 signals
|
|
signal ioSha1En_n_s : std_logic;
|
|
signal sha1Irq_s : std_logic;
|
|
signal ioDataSha1_s : std_logic_vector(7 downto 0);
|
|
|
|
-- external io interface
|
-- external io interface
|
signal ioDataExt_s : std_logic_vector(7 downto 0);
|
signal ioDataExt_s : std_logic_vector(7 downto 0);
|
signal ioExtEn_n_s : std_logic;
|
signal ioExtEn_n_s : std_logic;
|
|
|
|
|
begin
|
begin
|
|
|
clk_s <= clk;
|
clk_s <= clk;
|
|
|
rst_n_s <= rst_n;
|
rst_n_s <= rst_n;
|
Line 219... |
Line 233... |
stall_n_s <= stall_n;
|
stall_n_s <= stall_n;
|
stalled_n <= stalled_n_s;
|
stalled_n <= stalled_n_s;
|
|
|
irqLineAck <= irqLineAck_s(0); -- export IRQ 0
|
irqLineAck <= irqLineAck_s(0); -- export IRQ 0
|
|
|
irqLine_s <= ioPortIrq_s & timer_irq_s & sha1Irq_s & spiIrq_s & irqLine;
|
irqLine_s <= ioPortIrq_s & timer_irq_s & '0' & spiIrq_s & irqLine;
|
|
|
instMemAddr <= instAddr_s;
|
instMemAddr <= instAddr_s;
|
instDataIn_s <= instMemDataIn;
|
instDataIn_s <= instMemDataIn;
|
instMemEn_n <= instEn_n_s;
|
instMemEn_n <= instEn_n_s;
|
|
|
Line 234... |
Line 248... |
dataMemWr_n <= dataWr_n_s;
|
dataMemWr_n <= dataWr_n_s;
|
|
|
ioDataIn_s <= ioDataGpio_s when ioPortEn_n_s = '0' else
|
ioDataIn_s <= ioDataGpio_s when ioPortEn_n_s = '0' else
|
ioTimerDataOut_s when ioTimerEn_n_s = '0' else
|
ioTimerDataOut_s when ioTimerEn_n_s = '0' else
|
ioDataSpi_s when ioSpiEn_n_s = '0' else
|
ioDataSpi_s when ioSpiEn_n_s = '0' else
|
ioDataSha1_s when ioSha1En_n_s = '0' else
|
|
ioDataExt_s;
|
ioDataExt_s;
|
|
|
vliwProc_i : vliwProc
|
vliwProc_i : vliwProc
|
port map (
|
port map (
|
clk => clk_s,
|
clk => clk_s,
|
Line 289... |
Line 302... |
SS => spi_cs,
|
SS => spi_cs,
|
MOSI => spi_mosi,
|
MOSI => spi_mosi,
|
MISO => spi_miso
|
MISO => spi_miso
|
);
|
);
|
|
|
ioSha1En_n_s <= ioEn_n_s when ioAddr_s(7 downto 2) = "000111" else
|
|
'1';
|
|
|
|
sha1_i : sha1_ex
|
|
port map (
|
|
resetn => rst_n_s,
|
|
clk => clk_s,
|
|
cen => ioSha1En_n_s,
|
|
wen => ioWr_n_s,
|
|
addr => ioAddr_s(1 downto 0),
|
|
d_in => ioDataOut_s,
|
|
intr => sha1Irq_s,
|
|
intra => irqLineAck_s(2),
|
|
d_out => ioDataSha1_s
|
|
);
|
|
|
|
ioPortEn_n_s <= ioEn_n_s when ioAddr_s(7 downto 3) = "00100" else
|
ioPortEn_n_s <= ioEn_n_s when ioAddr_s(7 downto 3) = "00100" else
|
'1';
|
'1';
|
|
|
ioport_i : ioport
|
ioport_i : ioport
|
port map (
|
port map (
|