gpm module and exec first buggy version.
[calu.git] / cpu / src / gpm_b.vhd
diff --git a/cpu/src/gpm_b.vhd b/cpu/src/gpm_b.vhd
new file mode 100644 (file)
index 0000000..0818304
--- /dev/null
@@ -0,0 +1,63 @@
+library IEEE;
+use IEEE.std_logic_1164.all;
+use IEEE.numeric_std.all;
+
+use work.common_pkg.all;
+use work.alu_pkg.all;
+
+entity gpm is
+
+       generic (
+                       -- active reset value
+                       RESET_VALUE : std_logic;
+                       -- active logic value
+                       --LOGIC_ACT : std_logic
+                       
+                       );
+       port(
+               --System inputs
+                clk : in std_logic;
+               reset : in std_logic;
+
+                --exti : in extmod_rec;
+                --alu outpus
+                alu_nxt : in alu_result_rec;
+                --input
+                
+                --output
+                psw     : out status_rec;
+                --to memcnt
+                --addr : out gp_register_t;
+                --mem_en : out std_logic;
+                --ldst : out std_logic;
+                --, hw,byte: std_logic;
+                --to output bus
+                --exto : out data_ram_word_t
+                        
+        );
+               
+end gpm;
+
+architecture behaviour of gpm is
+type gpm_internal is record
+        status : status_rec;
+end record gpm_internal;
+
+reg, reg_nxt : gpm_internal;
+
+begin
+syn : process (clk, reset)
+        if reset = RESET_VALUE then
+                reg <= (('0','0','0','0'));
+        elsif rising_edge(clk) then
+                reg <= reg_nxt;
+        end if;
+end process syn;
+
+asyn : process (clk, reset)
+        reg_nxt <= alu_nxt.status;
+end process asyn;
+
+psw <= reg;
+        
+end architecture behaviour;