File: ../../Sources/A20_compute_temp.vhd
0: ----------------------------------------------------------------------------------
1: -- Engineer: Vitor Mendes Camilo
2: --
3: -- Module Name: A20_compute_temp - Behavioral
4: -- Description: Code segment A.20 — computation of the auxiliary variable TEMP.
5: -- Q = RItype + 365, so a single context read (Aq, Nq at Q)
6: -- supplies everything needed:
7: -- RItype = 0 → TEMP = Aq (N unused)
8: -- RItype = 1 → TEMP = Aq + (Nq >> 1)
9: --
10: ----------------------------------------------------------------------------------
11:
12: library ieee;
13: use ieee.std_logic_1164.all;
14: use ieee.numeric_std.all;
15: use work.openjls_pkg.all;
16:
17: entity a20_compute_temp is
18: generic (
19: A_WIDTH : natural := CO_AQ_WIDTH_STD;
20: N_WIDTH : natural := CO_NQ_WIDTH_STD
21: );
22: port (
23: iRItype : in std_logic;
24: iAq : in unsigned (A_WIDTH - 1 downto 0);
25: iNq : in unsigned (N_WIDTH - 1 downto 0);
26: oTemp : out unsigned (A_WIDTH - 1 downto 0)
27: );
28: end entity a20_compute_temp;
29:
30: architecture behavioral of a20_compute_temp is
31:
32: begin
33:
34: assert A_WIDTH >= N_WIDTH
35: report "A_WIDTH has to be >= than N_WIDTH"
36: severity failure;
37:
38: oTemp <= iAq when iRItype = '0' else
39: iAq + resize(shift_right(iNq, 1), A_WIDTH);
40:
41: end architecture behavioral;