Rob Posted February 2, 2013 Report Share Posted February 2, 2013 Hi again, In a previous thread Jack and I discovered that there was no interrupt controller in the AVR8 Soft Core. I thought it would be an interesting learning experience to write one. I have finally managed to make it work. So I'm going to share it here step by step. This will be based on the AVR8 Softcore V1.6. I'm still learning vhdl myself so if I make any mistakes, please correct me. Here goes: Part 1: Modify Portx.vhdl, so that we can access the port pins without breaking the normal operation of the port Step 1: Add the following line to the port definition at the top of Portx.vhd: irqlines : out std_logic_vector(7 downto 0) Your port definition should look like this now: entity pport is generic(PPortNum : natural); port( -- AVR Control ireset : in std_logic; cp2 : in std_logic; adr : in std_logic_vector(15 downto 0); dbus_in : in std_logic_vector(7 downto 0); dbus_out : out std_logic_vector(7 downto 0); iore : in std_logic; iowe : in std_logic; out_en : out std_logic; -- External connection portx : out std_logic_vector(7 downto 0); ddrx : out std_logic_vector(7 downto 0); pinx : in std_logic_vector(7 downto 0); irqlines : out std_logic_vector(7 downto 0));end pport; Step 2: Add this line to the DBusOutMux generator in Portx.vhd: irqlines(i) <= PINx_Resync(i); Your DBusOutMux generator should now look like this: DBusOutMux:for i in pinx'range generatedbus_out(i) <= (PORTx_Int(i) and PORTx_Sel)or(DDRx_Int(i) and DDRx_Sel)or(PINx_Resync(i) and PINx_Sel);irqlines(i) <= PINx_Resync(i);end generate; Ok, that's it for part 1. I'm going to separate each part into its own post to keep the size manageable. Rob P.S. I tried to attach the finished portx.vhd file to this post but got this message: portx.vhd You aren't permitted to upload this kind of file Is there a better place to share a complete file? Link to comment Share on other sites More sharing options...
This topic is now archived and is closed to further replies.