Line 1... |
Line 1... |
--##############################################################################
|
--##############################################################################
|
-- ION MIPS-compatible CPU demo on Terasic DE-1 Cyclone-II starter board
|
-- ION MIPS-compatible CPU demo on Terasic DE-1 Cyclone-II starter board
|
--##############################################################################
|
--##############################################################################
|
-- This module is little more than a wrapper around the CPU and its memories.
|
-- This module is little more than a wrapper around the SoC.
|
-- Synthesize with 'balanced' optimization for best results.
|
-- Synthesize with 'speed' optimization for best results.
|
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
-- NOTE: See note at bottom of file about optional use of PLL.
|
-- NOTE: See note at bottom of file about optional use of PLL.
|
--##############################################################################
|
--##############################################################################
|
-- Copyright (C) 2011 Jose A. Ruiz
|
-- Copyright (C) 2011 Jose A. Ruiz
|
--
|
--
|
Line 33... |
Line 33... |
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;
|
use ieee.std_logic_unsigned.all;
|
use ieee.std_logic_unsigned.all;
|
use work.mips_pkg.all; -- Only needed if port debug_info is not OPEN
|
use work.mips_pkg.all; -- Only needed if port debug_info is not OPEN
|
|
use work.obj_code_pkg.all;
|
|
|
-- FPGA i/o for Terasic DE-1 board
|
-- FPGA i/o for Terasic DE-1 board
|
-- (Many of the board's i/o devices will go unused in this demo)
|
-- (Many of the board's i/o devices will go unused in this demo)
|
entity c2sb_demo is
|
entity c2sb_demo is
|
port (
|
port (
|
Line 220... |
Line 221... |
end function nibble_to_7seg;
|
end function nibble_to_7seg;
|
|
|
|
|
begin
|
begin
|
|
|
mpu: entity work.mips_mpu
|
mpu: entity work.mips_soc
|
generic map (
|
generic map (
|
|
OBJ_CODE => obj_code,
|
CLOCK_FREQ => CLOCK_FREQ,
|
CLOCK_FREQ => CLOCK_FREQ,
|
SRAM_ADDR_SIZE => SRAM_ADDR_SIZE
|
SRAM_ADDR_SIZE => SRAM_ADDR_SIZE
|
)
|
)
|
port map (
|
port map (
|
interrupt => "00000000",
|
interrupt => "00000000",
|
Line 262... |
Line 264... |
hex_display_register:
|
hex_display_register:
|
process(clk)
|
process(clk)
|
begin
|
begin
|
if clk'event and clk='1' then
|
if clk'event and clk='1' then
|
if io_byte_we/="0000" and io_wr_addr(15 downto 12)=X"2" then
|
if io_byte_we/="0000" and io_wr_addr(15 downto 12)=X"2" then
|
reg_display(15 downto 0) <= io_wr_data(15 downto 0);
|
--reg_display(15 downto 0) <= io_wr_data(15 downto 0);
|
--reg_display <= mpu_sram_address;
|
reg_display <= mpu_sram_address;
|
end if;
|
end if;
|
end if;
|
end if;
|
end process hex_display_register;
|
end process hex_display_register;
|
|
|
sd_control_register:
|
sd_control_register:
|
Line 454... |
Line 456... |
-- QUAD 7-SEGMENT DISPLAYS
|
-- QUAD 7-SEGMENT DISPLAYS
|
--##############################################################################
|
--##############################################################################
|
|
|
-- Show contents of debug register in hex display
|
-- Show contents of debug register in hex display
|
display_data <=
|
display_data <=
|
reg_display(15 downto 0);-- when switches(0)='0' else
|
reg_display(15 downto 0) when switches(0)='0' else
|
--reg_display(31 downto 16);
|
reg_display(31 downto 16);
|
|
|
|
|
-- 7-segment encoders; the dev board displays are not multiplexed or encoded
|
-- 7-segment encoders; the dev board displays are not multiplexed or encoded
|
hex3 <= nibble_to_7seg(display_data(15 downto 12));
|
hex3 <= nibble_to_7seg(display_data(15 downto 12));
|
hex2 <= nibble_to_7seg(display_data(11 downto 8));
|
hex2 <= nibble_to_7seg(display_data(11 downto 8));
|