-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christer
committed
Nov 12, 2012
1 parent
000c3ca
commit 218b66e
Showing
44 changed files
with
1,602 additions
and
1,385 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,93 @@ | ||
---------------------------------------------------------------------------------- | ||
-- Company: | ||
-- Engineer: | ||
-- | ||
-- Create Date: 14:22:51 11/12/2012 | ||
-- Design Name: | ||
-- Module Name: hazard_detection - Behavioral | ||
-- Project Name: | ||
-- Target Devices: | ||
-- Tool versions: | ||
-- Description: | ||
-- | ||
-- Dependencies: | ||
-- | ||
-- Revision: | ||
-- Revision 0.01 - File Created | ||
-- Additional Comments: | ||
-- | ||
---------------------------------------------------------------------------------- | ||
library IEEE; | ||
use IEEE.STD_LOGIC_1164.ALL; | ||
use ieee.std_logic_arith.all; | ||
|
||
-- Uncomment the following library declaration if using | ||
-- arithmetic functions with Signed or Unsigned values | ||
--use IEEE.NUMERIC_STD.ALL; | ||
|
||
-- Uncomment the following library declaration if instantiating | ||
-- any Xilinx primitives in this code. | ||
--library UNISIM; | ||
--use UNISIM.VComponents.all; | ||
|
||
entity hazard_detection is | ||
Port ( CLK : in STD_LOGIC; | ||
RESET : in STD_LOGIC; | ||
ex_zero : in STD_LOGIC; | ||
ex_branch : in STD_LOGIC; | ||
ex_mem_read : in STD_LOGIC; | ||
ex_register_rt : in STD_LOGIC_VECTOR (4 downto 0); | ||
id_register_rs : in STD_LOGIC_VECTOR (4 downto 0); | ||
id_register_rt : in STD_LOGIC_VECTOR (4 downto 0); | ||
reset_ifid : out STD_LOGIC; | ||
reset_idex : out STD_LOGIC; | ||
pc_write : out STD_LOGIC; | ||
ifid_write : out STD_LOGIC; | ||
stall_to_mux : out STD_LOGIC); | ||
end hazard_detection; | ||
|
||
architecture Behavioral of hazard_detection is | ||
|
||
signal counter: integer := 0; | ||
|
||
begin | ||
process(CLK, RESET, ex_mem_read, ex_register_rt, ex_zero, ex_branch, id_register_rs, id_register_rt) | ||
begin | ||
if (RESET = '1') then | ||
counter <= 0; | ||
stall_to_mux <= '0'; | ||
reset_ifid <= '0'; | ||
reset_idex <= '0'; | ||
ifid_write <= '1'; | ||
pc_write <= '1'; | ||
elsif (counter = 0) then | ||
if ((ex_mem_read = '1') and ((ex_register_rt = id_register_rs) or (ex_register_rt = id_register_rt))) then | ||
-- stall for register read | ||
counter <= 2; | ||
reset_idex <= '0'; | ||
stall_to_mux <= '1'; | ||
pc_write <= '0'; | ||
ifid_write <= '0'; | ||
elsif((ex_zero = '1') and (ex_branch = '1')) then | ||
-- flush for branching | ||
reset_idex <= '1'; | ||
reset_ifid <= '1'; | ||
counter <= 1; | ||
ifid_write <= '0'; | ||
else | ||
-- no stalling | ||
stall_to_mux <= '0'; | ||
reset_idex <= '0'; | ||
pc_write <= '1'; | ||
ifid_write <= '1'; | ||
end if; | ||
else | ||
if rising_edge(CLK) then | ||
counter <= (counter - 1); | ||
end if; | ||
end if; | ||
end process; | ||
|
||
end Behavioral; | ||
|
||
---------------------------------------------------------------------------------- | ||
-- Company: | ||
-- Engineer: | ||
-- | ||
-- Create Date: 14:22:51 11/12/2012 | ||
-- Design Name: | ||
-- Module Name: hazard_detection - Behavioral | ||
-- Project Name: | ||
-- Target Devices: | ||
-- Tool versions: | ||
-- Description: | ||
-- | ||
-- Dependencies: | ||
-- | ||
-- Revision: | ||
-- Revision 0.01 - File Created | ||
-- Additional Comments: | ||
-- | ||
---------------------------------------------------------------------------------- | ||
library IEEE; | ||
use IEEE.STD_LOGIC_1164.ALL; | ||
use ieee.std_logic_arith.all; | ||
|
||
-- Uncomment the following library declaration if using | ||
-- arithmetic functions with Signed or Unsigned values | ||
--use IEEE.NUMERIC_STD.ALL; | ||
|
||
-- Uncomment the following library declaration if instantiating | ||
-- any Xilinx primitives in this code. | ||
--library UNISIM; | ||
--use UNISIM.VComponents.all; | ||
|
||
entity hazard_detection is | ||
Port ( CLK : in STD_LOGIC; | ||
RESET : in STD_LOGIC; | ||
ex_zero : in STD_LOGIC; | ||
ex_branch : in STD_LOGIC; | ||
ex_mem_read : in STD_LOGIC; | ||
ex_register_rt : in STD_LOGIC_VECTOR (4 downto 0); | ||
id_register_rs : in STD_LOGIC_VECTOR (4 downto 0); | ||
id_register_rt : in STD_LOGIC_VECTOR (4 downto 0); | ||
reset_ifid : out STD_LOGIC; | ||
reset_idex : out STD_LOGIC; | ||
pc_write : out STD_LOGIC; | ||
ifid_write : out STD_LOGIC; | ||
stall_to_mux : out STD_LOGIC); | ||
end hazard_detection; | ||
|
||
architecture Behavioral of hazard_detection is | ||
|
||
signal counter: integer := 0; | ||
|
||
begin | ||
process(CLK, RESET, ex_mem_read, ex_register_rt, ex_zero, ex_branch, id_register_rs, id_register_rt) | ||
begin | ||
if (RESET = '1') then | ||
counter <= 0; | ||
stall_to_mux <= '0'; | ||
reset_ifid <= '0'; | ||
reset_idex <= '0'; | ||
ifid_write <= '1'; | ||
pc_write <= '1'; | ||
elsif (counter <= 0) and rising_edge(CLK) then | ||
if ((ex_mem_read = '1') and ((ex_register_rt = id_register_rs) or (ex_register_rt = id_register_rt))) then | ||
-- stall for register read | ||
counter <= 2; | ||
reset_idex <= '0'; | ||
stall_to_mux <= '1'; | ||
pc_write <= '0'; | ||
ifid_write <= '0'; | ||
elsif((ex_zero = '1') and (ex_branch = '1')) then | ||
-- flush for branching | ||
reset_idex <= '1'; | ||
reset_ifid <= '1'; | ||
counter <= 1; | ||
ifid_write <= '0'; | ||
else | ||
-- no stalling | ||
stall_to_mux <= '0'; | ||
reset_ifid <= '0'; | ||
reset_idex <= '0'; | ||
pc_write <= '1'; | ||
ifid_write <= '1'; | ||
end if; | ||
else | ||
if rising_edge(CLK) then | ||
counter <= (counter - 1); | ||
end if; | ||
end if; | ||
end process; | ||
|
||
end Behavioral; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,51 @@ | ||
set -tmpdir "Z:/github/tdt4255/oving1/xst/projnav.tmp" | ||
set -xsthdpdir "Z:/github/tdt4255/oving1/xst" | ||
run -compileonly yes | ||
-p xc6slx16-2-csg324 | ||
-top hazard_detection | ||
-opt_mode Speed | ||
-opt_level 1 | ||
-power NO | ||
-iuc NO | ||
-keep_hierarchy No | ||
-netlist_hierarchy As_Optimized | ||
-rtlview Yes | ||
-glob_opt AllClockNets | ||
-read_cores YES | ||
-write_timing_constraints NO | ||
-cross_clock_analysis NO | ||
-hierarchy_separator / | ||
-bus_delimiter <> | ||
-case Maintain | ||
-slice_utilization_ratio 100 | ||
-bram_utilization_ratio 100 | ||
-dsp_utilization_ratio 100 | ||
-lc Auto | ||
-reduce_control_sets Auto | ||
-fsm_extract YES -fsm_encoding Auto | ||
-safe_implementation No | ||
-fsm_style LUT | ||
-ram_extract Yes | ||
-ram_style Auto | ||
-rom_extract Yes | ||
-shreg_extract YES | ||
-rom_style Auto | ||
-auto_bram_packing NO | ||
-resource_sharing YES | ||
-async_to_sync NO | ||
-shreg_min_size 2 | ||
-use_dsp48 Auto | ||
-iobuf YES | ||
-max_fanout 100000 | ||
-bufg 16 | ||
-register_duplication YES | ||
-register_balancing No | ||
-optimize_primitives NO | ||
-use_clock_enable Auto | ||
-use_sync_set Auto | ||
-use_sync_reset Auto | ||
-iob Auto | ||
-equivalent_register_removal YES | ||
-slice_utilization_ratio_maxmargin 5 | ||
-ifn hazard_detection.prj | ||
-ifmt mixed | ||
set -tmpdir "C:/Users/chribru/Desktop/GitHub/tdt4255/oving1/xst/projnav.tmp" | ||
set -xsthdpdir "C:/Users/chribru/Desktop/GitHub/tdt4255/oving1/xst" | ||
run -compileonly yes | ||
-p xc6slx16-2-csg324 | ||
-top hazard_detection | ||
-opt_mode Speed | ||
-opt_level 1 | ||
-power NO | ||
-iuc NO | ||
-keep_hierarchy No | ||
-netlist_hierarchy As_Optimized | ||
-rtlview Yes | ||
-glob_opt AllClockNets | ||
-read_cores YES | ||
-write_timing_constraints NO | ||
-cross_clock_analysis NO | ||
-hierarchy_separator / | ||
-bus_delimiter <> | ||
-case Maintain | ||
-slice_utilization_ratio 100 | ||
-bram_utilization_ratio 100 | ||
-dsp_utilization_ratio 100 | ||
-lc Auto | ||
-reduce_control_sets Auto | ||
-fsm_extract YES -fsm_encoding Auto | ||
-safe_implementation No | ||
-fsm_style LUT | ||
-ram_extract Yes | ||
-ram_style Auto | ||
-rom_extract Yes | ||
-shreg_extract YES | ||
-rom_style Auto | ||
-auto_bram_packing NO | ||
-resource_sharing YES | ||
-async_to_sync NO | ||
-shreg_min_size 2 | ||
-use_dsp48 Auto | ||
-iobuf YES | ||
-max_fanout 100000 | ||
-bufg 16 | ||
-register_duplication YES | ||
-register_balancing No | ||
-optimize_primitives NO | ||
-use_clock_enable Auto | ||
-use_sync_set Auto | ||
-use_sync_reset Auto | ||
-iob Auto | ||
-equivalent_register_removal YES | ||
-slice_utilization_ratio_maxmargin 5 | ||
-ifn hazard_detection.prj | ||
-ifmt mixed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.