OpenCores
URL https://opencores.org/ocsvn/neo430/neo430/trunk

Subversion Repositories neo430

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /neo430/trunk
    from Rev 143 to Rev 144
    Reverse comparison

Rev 143 → Rev 144

/README.md
43,7 → 43,6
(optional modules are marked using dashed lines in the figure above)
 
 
 
- 16-bit open source soft-core microcontroller-like processor system
- Code-efficient CISC-like instruction capabilities
- Full support of the original MSP430 instruction set architecture
51,7 → 50,7
- Application compilation scripts for Windows and Linux/Cygwin
- Completely described in behavioral, platform-independent VHDL
- Fully synchronous design, no latches, no gated clocks
- Very small outline and high operating frequency compared to other implementations ;)
- Very small outline and high operating frequency
- Internal DMEN (RAM, for data) and IMEM (RAM or ROM, for code), configurable sizes
- One external interrupt line
- Customizable processor hardware configuration
63,9 → 62,9
- Optional watchdog timer (WDT)
- Optional cyclic redundancy check unit (CRC16/32)
- Optional custom functions unit (CFU) for user-defined processor extensions
- Optional 3 channel 8-bit PWM controller
- Optional 3 channel 8-bit PWM controller (PWM)
- Optional true random number generator (TRNG)
- Optional internal bootloader (2kB ROM) with serial user console and automatic boot from external EEPROM
- Optional internal bootloader (2kB ROM) with serial user console and automatic boot from external SPI EEPROM
 
 
## Differences to TI's Original MSP430(TM) Processors
/doc/NEO430.pdf Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
/rtl/core/neo430_bootloader_image.vhd
295,7 → 295,7
000284 => x"9308",
000285 => x"200e",
000286 => x"403c",
000287 => x"f6b0",
000287 => x"f6b1",
000288 => x"1287",
000289 => x"4039",
000290 => x"f0b4",
309,7 → 309,7
000298 => x"4030",
000299 => x"f230",
000300 => x"403c",
000301 => x"f6c4",
000301 => x"f6c5",
000302 => x"4030",
000303 => x"f240",
000304 => x"484d",
337,7 → 337,7
000326 => x"9126",
000327 => x"2018",
000328 => x"403c",
000329 => x"f6d0",
000329 => x"f6d1",
000330 => x"1287",
000331 => x"4392",
000332 => x"8002",
454,7 → 454,7
000443 => x"403a",
000444 => x"f038",
000445 => x"403c",
000446 => x"f6d3",
000446 => x"f6d4",
000447 => x"128a",
000448 => x"4039",
000449 => x"f1e0",
462,7 → 462,7
000451 => x"fff0",
000452 => x"1289",
000453 => x"403c",
000454 => x"f70d",
000454 => x"f70e",
000455 => x"128a",
000456 => x"472c",
000457 => x"1289",
470,25 → 470,25
000459 => x"fffc",
000460 => x"1289",
000461 => x"403c",
000462 => x"f716",
000462 => x"f717",
000463 => x"128a",
000464 => x"421c",
000465 => x"fff6",
000466 => x"1289",
000467 => x"403c",
000468 => x"f71f",
000468 => x"f720",
000469 => x"128a",
000470 => x"421c",
000471 => x"fffa",
000472 => x"1289",
000473 => x"403c",
000474 => x"f728",
000474 => x"f729",
000475 => x"128a",
000476 => x"421c",
000477 => x"fff2",
000478 => x"1289",
000479 => x"403c",
000480 => x"f731",
000480 => x"f732",
000481 => x"128a",
000482 => x"4037",
000483 => x"8004",
503,7 → 503,7
000492 => x"435c",
000493 => x"1286",
000494 => x"403c",
000495 => x"f758",
000495 => x"f759",
000496 => x"128a",
000497 => x"1285",
000498 => x"4039",
512,15 → 512,15
000501 => x"930c",
000502 => x"37f1",
000503 => x"403c",
000504 => x"f75a",
000504 => x"f75b",
000505 => x"128a",
000506 => x"403c",
000507 => x"f765",
000507 => x"f766",
000508 => x"128a",
000509 => x"4036",
000510 => x"f024",
000511 => x"403c",
000512 => x"f7cb",
000512 => x"f7cc",
000513 => x"128a",
000514 => x"492c",
000515 => x"930c",
529,7 → 529,7
000518 => x"474c",
000519 => x"1286",
000520 => x"403c",
000521 => x"f758",
000521 => x"f759",
000522 => x"128a",
000523 => x"9077",
000524 => x"0072",
563,7 → 563,7
000552 => x"0068",
000553 => x"2005",
000554 => x"403c",
000555 => x"f765",
000555 => x"f766",
000556 => x"128a",
000557 => x"4030",
000558 => x"f3fe",
572,13 → 572,13
000561 => x"203b",
000562 => x"4347",
000563 => x"403c",
000564 => x"f758",
000564 => x"f759",
000565 => x"128a",
000566 => x"470c",
000567 => x"12b0",
000568 => x"f1e0",
000569 => x"403c",
000570 => x"f7d3",
000570 => x"f7d4",
000571 => x"128a",
000572 => x"470d",
000573 => x"503d",
597,7 → 597,7
000586 => x"0004",
000587 => x"23f6",
000588 => x"403c",
000589 => x"f7d7",
000589 => x"f7d8",
000590 => x"128a",
000591 => x"4704",
000592 => x"446c",
641,7 → 641,7
000630 => x"0070",
000631 => x"2050",
000632 => x"403c",
000633 => x"f7da",
000633 => x"f7db",
000634 => x"128a",
000635 => x"492c",
000636 => x"930c",
650,7 → 650,7
000639 => x"0079",
000640 => x"237e",
000641 => x"403c",
000642 => x"f7e9",
000642 => x"f7ea",
000643 => x"128a",
000644 => x"4037",
000645 => x"ffa0",
703,7 → 703,7
000692 => x"426c",
000693 => x"1287",
000694 => x"403c",
000695 => x"f6d0",
000695 => x"f6d1",
000696 => x"4030",
000697 => x"f458",
000698 => x"442f",
734,7 → 734,7
000723 => x"4030",
000724 => x"f3fe",
000725 => x"403c",
000726 => x"f7f6",
000726 => x"f7f7",
000727 => x"4030",
000728 => x"f458",
000729 => x"4134",
863,175 → 863,175
000852 => x"0020",
000853 => x"0a07",
000854 => x"5245",
000855 => x"0052",
000856 => x"7741",
000857 => x"6961",
000858 => x"6974",
000859 => x"676e",
000860 => x"4220",
000861 => x"4e49",
000862 => x"5845",
000863 => x"2e45",
000855 => x"5f52",
000856 => x"4100",
000857 => x"6177",
000858 => x"7469",
000859 => x"6e69",
000860 => x"2067",
000861 => x"4942",
000862 => x"454e",
000863 => x"4558",
000864 => x"2e2e",
000865 => x"0020",
000866 => x"6f4c",
000867 => x"6461",
000868 => x"6e69",
000869 => x"2e67",
000865 => x"202e",
000866 => x"4c00",
000867 => x"616f",
000868 => x"6964",
000869 => x"676e",
000870 => x"2e2e",
000871 => x"0020",
000872 => x"4b4f",
000873 => x"0a00",
000874 => x"4e0a",
000875 => x"4f45",
000876 => x"3334",
000877 => x"2030",
000878 => x"6f42",
000879 => x"746f",
000880 => x"6f6c",
000881 => x"6461",
000882 => x"7265",
000883 => x"5620",
000884 => x"3032",
000885 => x"3831",
000886 => x"3430",
000887 => x"3432",
000888 => x"6220",
000889 => x"2079",
000890 => x"7453",
000891 => x"7065",
000892 => x"6168",
000893 => x"206e",
000894 => x"6f4e",
000895 => x"746c",
000896 => x"6e69",
000897 => x"0a67",
000898 => x"480a",
000899 => x"5657",
000900 => x"203a",
000901 => x"7830",
000902 => x"0a00",
000903 => x"4c43",
000904 => x"3a4b",
000905 => x"3020",
000906 => x"0078",
000907 => x"520a",
000908 => x"4d4f",
000909 => x"203a",
000910 => x"7830",
000911 => x"0a00",
000912 => x"4152",
000913 => x"3a4d",
000914 => x"3020",
000915 => x"0078",
000916 => x"530a",
000917 => x"5359",
000918 => x"203a",
000919 => x"7830",
000920 => x"0a00",
000921 => x"410a",
000922 => x"7475",
000923 => x"626f",
000924 => x"6f6f",
000925 => x"2074",
000926 => x"6e69",
000927 => x"3820",
000928 => x"2e73",
000929 => x"5020",
000930 => x"6572",
000931 => x"7373",
000932 => x"6b20",
000933 => x"7965",
000934 => x"7420",
000935 => x"206f",
000936 => x"6261",
000937 => x"726f",
000938 => x"2e74",
000939 => x"000a",
000940 => x"000a",
000941 => x"6241",
000942 => x"726f",
000943 => x"6574",
000944 => x"2e64",
000945 => x"0a0a",
000946 => x"4300",
000947 => x"6d6f",
000948 => x"616d",
000949 => x"646e",
000950 => x"3a73",
000951 => x"200a",
000952 => x"3a64",
000953 => x"4420",
000954 => x"6d75",
000955 => x"2070",
000956 => x"454d",
000957 => x"0a4d",
000958 => x"6520",
000959 => x"203a",
000960 => x"6f4c",
000961 => x"6461",
000962 => x"4520",
000963 => x"5045",
000964 => x"4f52",
000965 => x"0a4d",
000966 => x"6820",
000967 => x"203a",
000968 => x"6548",
000969 => x"706c",
000970 => x"200a",
000971 => x"3a70",
000972 => x"5320",
000973 => x"6f74",
000974 => x"6572",
000975 => x"4520",
000976 => x"5045",
000977 => x"4f52",
000978 => x"0a4d",
000979 => x"7220",
000980 => x"203a",
000981 => x"6552",
000982 => x"7473",
000983 => x"7261",
000984 => x"0a74",
000985 => x"7320",
000986 => x"203a",
000987 => x"7453",
000988 => x"7261",
000989 => x"2074",
000990 => x"7061",
000991 => x"0a70",
000992 => x"7520",
000993 => x"203a",
000994 => x"7055",
000995 => x"6f6c",
000996 => x"6461",
000997 => x"0a00",
000998 => x"4d43",
000999 => x"3a44",
001000 => x"203e",
001001 => x"3a00",
001002 => x"2020",
001003 => x"2000",
001004 => x"007c",
001005 => x"7250",
001006 => x"636f",
001007 => x"6565",
001008 => x"2064",
001009 => x"7928",
001010 => x"6e2f",
001011 => x"3f29",
001012 => x"0a00",
001013 => x"7257",
001014 => x"7469",
001015 => x"6e69",
001016 => x"2e67",
000871 => x"202e",
000872 => x"4f00",
000873 => x"004b",
000874 => x"0a0a",
000875 => x"454e",
000876 => x"344f",
000877 => x"3033",
000878 => x"4220",
000879 => x"6f6f",
000880 => x"6c74",
000881 => x"616f",
000882 => x"6564",
000883 => x"2072",
000884 => x"3256",
000885 => x"3130",
000886 => x"3038",
000887 => x"3234",
000888 => x"2037",
000889 => x"7962",
000890 => x"5320",
000891 => x"6574",
000892 => x"6870",
000893 => x"6e61",
000894 => x"4e20",
000895 => x"6c6f",
000896 => x"6974",
000897 => x"676e",
000898 => x"0a0a",
000899 => x"5748",
000900 => x"3a56",
000901 => x"3020",
000902 => x"0078",
000903 => x"430a",
000904 => x"4b4c",
000905 => x"203a",
000906 => x"7830",
000907 => x"0a00",
000908 => x"4f52",
000909 => x"3a4d",
000910 => x"3020",
000911 => x"0078",
000912 => x"520a",
000913 => x"4d41",
000914 => x"203a",
000915 => x"7830",
000916 => x"0a00",
000917 => x"5953",
000918 => x"3a53",
000919 => x"3020",
000920 => x"0078",
000921 => x"0a0a",
000922 => x"7541",
000923 => x"6f74",
000924 => x"6f62",
000925 => x"746f",
000926 => x"6920",
000927 => x"206e",
000928 => x"7338",
000929 => x"202e",
000930 => x"7250",
000931 => x"7365",
000932 => x"2073",
000933 => x"656b",
000934 => x"2079",
000935 => x"6f74",
000936 => x"6120",
000937 => x"6f62",
000938 => x"7472",
000939 => x"0a2e",
000940 => x"0a00",
000941 => x"4100",
000942 => x"6f62",
000943 => x"7472",
000944 => x"6465",
000945 => x"0a2e",
000946 => x"000a",
000947 => x"6f43",
000948 => x"6d6d",
000949 => x"6e61",
000950 => x"7364",
000951 => x"0a3a",
000952 => x"6420",
000953 => x"203a",
000954 => x"7544",
000955 => x"706d",
000956 => x"4d20",
000957 => x"4d45",
000958 => x"200a",
000959 => x"3a65",
000960 => x"4c20",
000961 => x"616f",
000962 => x"2064",
000963 => x"4545",
000964 => x"5250",
000965 => x"4d4f",
000966 => x"200a",
000967 => x"3a68",
000968 => x"4820",
000969 => x"6c65",
000970 => x"0a70",
000971 => x"7020",
000972 => x"203a",
000973 => x"7453",
000974 => x"726f",
000975 => x"2065",
000976 => x"4545",
000977 => x"5250",
000978 => x"4d4f",
000979 => x"200a",
000980 => x"3a72",
000981 => x"5220",
000982 => x"7365",
000983 => x"6174",
000984 => x"7472",
000985 => x"200a",
000986 => x"3a73",
000987 => x"5320",
000988 => x"6174",
000989 => x"7472",
000990 => x"6120",
000991 => x"7070",
000992 => x"200a",
000993 => x"3a75",
000994 => x"5520",
000995 => x"6c70",
000996 => x"616f",
000997 => x"0064",
000998 => x"430a",
000999 => x"444d",
001000 => x"3e3a",
001001 => x"0020",
001002 => x"203a",
001003 => x"0020",
001004 => x"7c20",
001005 => x"5000",
001006 => x"6f72",
001007 => x"6563",
001008 => x"6465",
001009 => x"2820",
001010 => x"2f79",
001011 => x"296e",
001012 => x"003f",
001013 => x"570a",
001014 => x"6972",
001015 => x"6974",
001016 => x"676e",
001017 => x"2e2e",
001018 => x"0020",
001019 => x"6142",
001020 => x"2064",
001021 => x"4d43",
001022 => x"2144",
001023 => x"0000",
001018 => x"202e",
001019 => x"4200",
001020 => x"6461",
001021 => x"4320",
001022 => x"444d",
001023 => x"0021",
others => x"0000"
);
 
/rtl/core/neo430_dmem.vhd
56,7 → 56,7
signal dmem_file_l : dmem_file_t;
signal dmem_file_h : dmem_file_t;
 
-- RAM attribute to inhibit bypass-logic - Altera only! --
-- RAM attribute to inhibit bypass-logic - Intel only! --
attribute ramstyle : string;
attribute ramstyle of dmem_file_l : signal is "no_rw_check";
attribute ramstyle of dmem_file_h : signal is "no_rw_check";
/rtl/core/neo430_imem.vhd
24,7 → 24,7
-- # You should have received a copy of the GNU Lesser General Public License along with this #
-- # source; if not, download it from https://www.gnu.org/licenses/lgpl-3.0.en.html #
-- # ********************************************************************************************* #
-- # Stephan Nolting, Hannover, Germany 29.01.2018 #
-- # Stephan Nolting, Hannover, Germany 27.04.2018 #
-- #################################################################################################
 
library ieee;
61,7 → 61,7
impure function init_imem(clear : boolean; hilo : std_ulogic; init : application_init_image_t) return imem_file8_t is
variable mem_v : imem_file8_t;
begin
if (clear = false) then
if (clear = false) then -- do not leave memory empty -> initialize with app code
for i in 0 to IMEM_SIZE/2-1 loop
if (hilo = '0') then -- low byte
mem_v(i) := init(i)(07 downto 00);
79,14 → 79,18
signal rden : std_ulogic;
signal addr : integer;
 
-- internal ROM type - do not init memory if bootloader is used --
signal imem_file_l : imem_file8_t := init_imem(BOOTLD_USE, '0', application_init_image);
signal imem_file_h : imem_file8_t := init_imem(BOOTLD_USE, '1', application_init_image);
-- internal "RAM" type - implemented if bootloader is used; initialize with app code if no bootloader is used --
signal imem_file_ram_l : imem_file8_t := init_imem(BOOTLD_USE, '0', application_init_image);
signal imem_file_ram_h : imem_file8_t := init_imem(BOOTLD_USE, '1', application_init_image);
 
-- RAM attribute to inhibit bypass-logic - Altera only! --
-- internal "ROM" type - implemented if bootloader is NOT used; always initialize with app code --
constant imem_file_rom_l : imem_file8_t := init_imem(false, '0', application_init_image);
constant imem_file_rom_h : imem_file8_t := init_imem(false, '1', application_init_image);
 
-- RAM attribute to inhibit bypass-logic - Intel only! --
attribute ramstyle : string;
attribute ramstyle of imem_file_l : signal is "no_rw_check";
attribute ramstyle of imem_file_h : signal is "no_rw_check";
attribute ramstyle of imem_file_ram_l : signal is "no_rw_check";
attribute ramstyle of imem_file_ram_h : signal is "no_rw_check";
 
begin
 
103,14 → 107,19
if rising_edge(clk_i) then
rden <= rden_i and acc_en;
if (acc_en = '1') then
if (wren_i(0) = '1') and (upen_i = '1') and (IMEM_AS_ROM = false) then
imem_file_l(addr) <= data_i(07 downto 0);
if (IMEM_AS_ROM = false) then -- implement IMEM as RAM
if (wren_i(0) = '1') and (upen_i = '1') then
imem_file_ram_l(addr) <= data_i(07 downto 0);
end if;
rdata(07 downto 0) <= imem_file_ram_l(addr);
if (wren_i(1) = '1') and (upen_i = '1') then
imem_file_ram_h(addr) <= data_i(15 downto 8);
end if;
rdata(15 downto 8) <= imem_file_ram_h(addr);
else -- implement IMEM as true ROM
rdata(07 downto 0) <= imem_file_rom_l(addr);
rdata(15 downto 8) <= imem_file_rom_h(addr);
end if;
rdata(07 downto 0) <= imem_file_l(addr);
if (wren_i(1) = '1') and (upen_i = '1') and (IMEM_AS_ROM = false) then
imem_file_h(addr) <= data_i(15 downto 8);
end if;
rdata(15 downto 8) <= imem_file_h(addr);
end if;
end if;
end process imem_file_access;
/rtl/core/neo430_package.vhd
170,13 → 170,12
constant trng_addr_c : std_ulogic_vector(15 downto 0) := std_ulogic_vector(unsigned(trng_base_c) + x"0000");
 
-- IO: RESERVED --
--constant ???_base_c : std_ulogic_vector(15 downto 0) := x"FFF0";
--constant ???_base_c : std_ulogic_vector(15 downto 0) := x"FFFA";
--constant ???_size_c : natural := 6; -- bytes
 
--constant ???_addr_c : std_ulogic_vector(15 downto 0) := std_ulogic_vector(unsigned(???_base_c) + x"0000");
--constant ???_addr_c : std_ulogic_vector(15 downto 0) := std_ulogic_vector(unsigned(???_base_c) + x"0002");
--constant ???_addr_c : std_ulogic_vector(15 downto 0) := std_ulogic_vector(unsigned(???_base_c) + x"0004");
--constant ???_addr_c : std_ulogic_vector(15 downto 0) := std_ulogic_vector(unsigned(???_base_c) + x"0006");
 
-- IO: System Configuration --
constant sysconfig_base_c : std_ulogic_vector(15 downto 0) := x"FFF0";
/rtl/core/neo430_trng.vhd
24,7 → 24,7
-- # You should have received a copy of the GNU Lesser General Public License along with this #
-- # source; if not, download it from https://www.gnu.org/licenses/lgpl-3.0.en.html #
-- # ********************************************************************************************* #
-- # Stephan Nolting, Hannover, Germany 25.04.2018 #
-- # Stephan Nolting, Hannover, Germany 30.04.2018 #
-- #################################################################################################
 
library ieee;
49,7 → 49,7
architecture neo430_trng_rtl of neo430_trng is
 
-- ADVANCED user configuration -------------------------------------------------------------------
constant num_trngs_c : natural := 6; -- number of random generators (= #oscillators, default = 6)
constant num_trngs_c : natural := 4; -- number of random generators (= #oscillators, default = 4)
-- -----------------------------------------------------------------------------------------------
 
-- control register bits --
61,19 → 61,18
 
-- access control --
signal acc_en : std_ulogic; -- module access enable
signal addr : std_ulogic_vector(15 downto 0); -- access address
signal wren : std_ulogic; -- full word write enable
signal rden : std_ulogic; -- read enable
 
-- random number generator --
signal sreg : std_ulogic_vector(7 downto 0);
signal cnt : std_ulogic_vector(2 downto 0);
signal rnd_gen : std_ulogic_vector(num_trngs_c-1 downto 0);
signal rnd_reset : std_ulogic_vector(num_trngs_c-1 downto 0);
signal rnd_enable : std_ulogic;
signal rnd_sync0 : std_ulogic_vector(num_trngs_c-1 downto 0);
signal rnd_sync1 : std_ulogic_vector(num_trngs_c-1 downto 0);
signal rnd_bit : std_ulogic;
signal rnd_sync0 : std_ulogic;
signal rnd_sync1 : std_ulogic;
signal rnd_sreg : std_ulogic_vector(7 downto 0);
signal rnd_cnt : std_ulogic_vector(2 downto 0);
signal rnd_data : std_ulogic_vector(7 downto 0); -- accessibe data register (read-only)
 
begin
81,7 → 80,6
-- Access Control -----------------------------------------------------------
-- -----------------------------------------------------------------------------
acc_en <= '1' when (addr_i(hi_abb_c downto lo_abb_c) = trng_base_c(hi_abb_c downto lo_abb_c)) else '0';
addr <= trng_base_c(15 downto lo_abb_c) & addr_i(lo_abb_c-1 downto 1) & '0'; -- word aligned
wren <= acc_en and wren_i(1) and wren_i(0);
rden <= acc_en and rden_i;
 
104,23 → 102,35
-- Random Generator ---------------------------------------------------------
-- -----------------------------------------------------------------------------
random_generator: process(rnd_reset, rnd_enable, rnd_gen)
variable rnd_v : std_ulogic;
begin
-- generators (oscillators) --
for i in 0 to num_trngs_c-1 loop
if (rnd_reset(i) = '1') then
rnd_gen(i) <= '0';
elsif (rnd_enable = '1') then -- yeah, these ARE latches ;)
rnd_gen(i) <= not rnd_gen(i); -- these are the oscillators
rnd_gen(i) <= not rnd_gen(i); -- here we have the oscillators
end if;
end loop; -- i
-- XOR all generators together --
rnd_v := rnd_gen(0);
end process random_generator;
 
-- synchronize output of each oscillator --
random_generator_sync: process(clk_i)
begin
if rising_edge(clk_i) then
rnd_sync0 <= rnd_gen;
rnd_sync1 <= rnd_sync0; -- no metastability beyond this point!
end if;
end process random_generator_sync;
 
-- XOR all generators --
random_generator_xor: process(rnd_sync1)
variable rnd_v : std_ulogic;
begin
rnd_v := rnd_sync1(0);
for i in 1 to num_trngs_c-1 loop
rnd_v := rnd_v xor rnd_gen(i);
rnd_v := rnd_v xor rnd_sync1(i);
end loop; -- i
rnd_bit <= rnd_v;
end process random_generator;
end process random_generator_xor;
 
 
-- Random Data Shift Register -----------------------------------------------
128,19 → 138,16
data_sreg: process(clk_i)
begin
if rising_edge(clk_i) then
-- synchronize data --
rnd_sync0 <= rnd_bit;
rnd_sync1 <= rnd_sync0;
-- acquire data --
if (rnd_enable = '0') then
cnt <= (others => '0');
rnd_cnt <= (others => '0');
else
cnt <= std_ulogic_vector(unsigned(cnt) + 1);
sreg <= sreg(6 downto 0) & rnd_sync1;
rnd_cnt <= std_ulogic_vector(unsigned(rnd_cnt) + 1);
rnd_sreg <= rnd_sreg(6 downto 0) & rnd_bit;
end if;
-- sample output byte --
if (cnt = "000") and (rnd_enable = '1') then
rnd_data <= sreg;
if (rnd_cnt = "000") and (rnd_enable = '1') then
rnd_data <= rnd_sreg;
end if;
end if;
end process data_sreg;
/sw/bootloader/bootloader.c
29,7 → 29,7
// # You should have received a copy of the GNU Lesser General Public License along with this #
// # source; if not, download it from https://www.gnu.org/licenses/lgpl-3.0.en.html #
// # ********************************************************************************************* #
// # Stephan Nolting, Hannover, Germany 24.04.2018 #
// # Stephan Nolting, Hannover, Germany 27.04.2018 #
// #################################################################################################
 
// Libraries
143,7 → 143,7
// ****************************************************************
// Show bootloader intro and system information
// ****************************************************************
uart_br_print("\n\nNEO430 Bootloader V20180424 by Stephan Nolting\n\n"
uart_br_print("\n\nNEO430 Bootloader V20180427 by Stephan Nolting\n\n"
"HWV: 0x");
uart_print_hex_word(HW_VERSION);
uart_br_print("\nCLK: 0x");
489,7 → 489,7
* ------------------------------------------------------------ */
void system_error(uint8_t err_code){
 
uart_br_print("\a\nERR");
uart_br_print("\a\nERR_");
uart_print_hex_byte(err_code);
 
asm volatile ("mov #0, r2"); // deactivate IRQs, no more write access to IMEM
/sw/example/game_of_life/main.c
19,7 → 19,7
// # You should have received a copy of the GNU Lesser General Public License along with this #
// # source; if not, download it from https://www.gnu.org/licenses/lgpl-3.0.en.html #
// # ********************************************************************************************* #
// # Stephan Nolting, Hannover, Germany 06.10.2017 #
// # Stephan Nolting, Hannover, Germany 27.04.2018 #
// #################################################################################################
 
 
68,16 → 68,28
_printf("You can pause/restart the simulation by pressing any key.\n");
 
// randomize until key pressed
while (uart_char_received() == 0) {
__xorshift32();
if ((SYS_FEATURES & (1<<SYS_TRNG_EN))) {
trng_enable();
_printf("\nTRNG detected. Will use TRNG to initialize universe.\n");
while (uart_char_received() == 0);
}
else {
while (uart_char_received() == 0) {
__xorshift32();
}
}
 
 
// initialize universe using random data
for (x=0; x<NUM_CELLS_X/8; x++) {
for (y=0; y<NUM_CELLS_Y; y++) {
universe[0][x][y] = (uint8_t)__xorshift32();
if ((SYS_FEATURES & (1<<SYS_TRNG_EN)))
universe[0][x][y] = trng_get_byte();
else
universe[0][x][y] = (uint8_t)__xorshift32();
}
}
trng_disable();
 
while(1) {
 
/sw/lib/neo430/neo430_aux.h
19,7 → 19,7
// # You should have received a copy of the GNU Lesser General Public License along with this #
// # source; if not, download it from https://www.gnu.org/licenses/lgpl-3.0.en.html #
// # ********************************************************************************************* #
// # Stephan Nolting, Hannover, Germany 29.12.2017 #
// # Stephan Nolting, Hannover, Germany 29.04.2018 #
// #################################################################################################
 
#ifndef neo430_aux_h
26,98 → 26,10
#define neo430_aux_h
 
// prototypes
void __memset(uint8_t *dst, uint8_t data, uint16_t num);
uint8_t __memcmp(uint8_t *dst, uint8_t *src, uint16_t num);
void __memcpy(uint8_t *dst, uint8_t *src, uint16_t num);
uint16_t __bit_rev16(uint16_t x);
uint32_t __xorshift32(void);
uint8_t config_timer_period(uint32_t f_timer);
uint32_t hexstr_to_uint(char *buffer, uint8_t length);
 
 
 
/* ------------------------------------------------------------
* INFO Memory initialization (byte-wise)
* PARAM dst: Byte-pointer to beginning of target memory space
* PARAM data: Init data
* PARAM num: Number of bytes to initialize
* ------------------------------------------------------------ */
void __memset(uint8_t *dst, uint8_t data, uint16_t num) {
 
while (num--)
*dst++ = data;
}
 
 
/* ------------------------------------------------------------
* INFO Compare memory to memory
* PARAM dst: Pointer to beginning of first memory space
* PARAM src: Pointer to beginning of second memory space
* PARAM num: Number of bytes to compare
* RETURN 0 if src == dst
* ------------------------------------------------------------ */
uint8_t __memcmp(uint8_t *dst, uint8_t *src, uint16_t num) {
 
while (num--) {
if (*dst++ != *src++)
return 1;
}
return 0;
}
 
 
/* ------------------------------------------------------------
* INFO Copy memory space SRC to DST (byte by byte)
* PARAM dst: Pointer to beginning destination memory space
* PARAM src: Pointer to beginning source memory space
* PARAM num: Number of bytes to copy
* ------------------------------------------------------------ */
void __memcpy(uint8_t *dst, uint8_t *src, uint16_t num) {
 
while (num--)
*dst++ = *src++;
}
 
 
/* ------------------------------------------------------------
* INFO 16-bit bit reversal
* PARAM input operand to be reversed
* RETURN reversed bit pattern
* ------------------------------------------------------------ */
uint16_t __bit_rev16(uint16_t x) {
 
register uint16_t z = x;
register uint16_t y = 0;
uint8_t i = 0;
 
for (i=0; i<8; i++) { // two-times unrolled
asm volatile ("rrc %[a], %[b]" : [b] "=r" (z) : "[b]" (z), [a] "r" (z));
asm volatile ("rlc %[c], %[d]" : [d] "=r" (y) : "[d]" (y), [c] "r" (y));
 
asm volatile ("rrc %[a], %[b]" : [b] "=r" (z) : "[b]" (z), [a] "r" (z));
asm volatile ("rlc %[c], %[d]" : [d] "=r" (y) : "[d]" (y), [c] "r" (y));
}
return y;
}
 
 
/* ------------------------------------------------------------
* INFO Pseudo-random number generator
* RETURN 32-bit random data
* ------------------------------------------------------------ */
uint32_t __xorshift32(void) {
 
static uint32_t x32 = 314159265;
 
x32 ^= x32 << 13;
x32 ^= x32 >> 17;
x32 ^= x32 << 5;
 
return x32;
}
 
 
/* ------------------------------------------------------------
* INFO Configure Timer period
* PARAM Timer frequency in Hz (1Hz ... F_CPU/2)
* RETURN 0 if successful, -1 if error
154,34 → 66,4
}
 
 
/* ------------------------------------------------------------
* INFO Convert N hex chars into uint32
* PARAM Pointer to buffer with hex chars
* PARAM Number of hex chars to convert (1..8)
* RETURN Conversion result
* ------------------------------------------------------------ */
uint32_t hexstr_to_uint(char *buffer, uint8_t length) {
 
uint32_t res = 0, d = 0;
char c = 0;
 
while (length--) {
c = *buffer++;
 
if ((c >= '0') && (c <= '9'))
d = (uint32_t)(c - '0');
else if ((c >= 'a') && (c <= 'f'))
d = (uint32_t)((c - 'a') + 10);
else if ((c >= 'A') && (c <= 'F'))
d = (uint32_t)((c - 'A') + 10);
else
d = 0;
 
res = res + (d << (length*4));
}
 
return res;
}
 
 
#endif // neo430_aux_h
/sw/lib/neo430/neo430_cpu.h
19,7 → 19,7
// # You should have received a copy of the GNU Lesser General Public License along with this #
// # source; if not, download it from https://www.gnu.org/licenses/lgpl-3.0.en.html #
// # ********************************************************************************************* #
// # Stephan Nolting, Hannover, Germany 26.01.2018 #
// # Stephan Nolting, Hannover, Germany 29.04.2018 #
// #################################################################################################
 
#ifndef neo430_cpu_h
41,6 → 41,11
inline uint16_t __bswap(uint16_t a);
inline uint16_t __combine_bytes(uint8_t hi, uint8_t lo);
inline uint16_t __dadd(uint16_t a, uint16_t b);
void __memset(uint8_t *dst, uint8_t data, uint16_t num);
uint8_t __memcmp(uint8_t *dst, uint8_t *src, uint16_t num);
void __memcpy(uint8_t *dst, uint8_t *src, uint16_t num);
uint16_t __bit_rev16(uint16_t x);
uint32_t __xorshift32(void);
 
 
/* ------------------------------------------------------------
220,4 → 225,85
}
 
 
/* ------------------------------------------------------------
* INFO Memory initialization (byte-wise)
* PARAM dst: Byte-pointer to beginning of target memory space
* PARAM data: Init data
* PARAM num: Number of bytes to initialize
* ------------------------------------------------------------ */
void __memset(uint8_t *dst, uint8_t data, uint16_t num) {
 
while (num--)
*dst++ = data;
}
 
 
/* ------------------------------------------------------------
* INFO Compare memory to memory
* PARAM dst: Pointer to beginning of first memory space
* PARAM src: Pointer to beginning of second memory space
* PARAM num: Number of bytes to compare
* RETURN 0 if src == dst
* ------------------------------------------------------------ */
uint8_t __memcmp(uint8_t *dst, uint8_t *src, uint16_t num) {
 
while (num--) {
if (*dst++ != *src++)
return 1;
}
return 0;
}
 
 
/* ------------------------------------------------------------
* INFO Copy memory space SRC to DST (byte by byte)
* PARAM dst: Pointer to beginning destination memory space
* PARAM src: Pointer to beginning source memory space
* PARAM num: Number of bytes to copy
* ------------------------------------------------------------ */
void __memcpy(uint8_t *dst, uint8_t *src, uint16_t num) {
 
while (num--)
*dst++ = *src++;
}
 
 
/* ------------------------------------------------------------
* INFO 16-bit bit reversal
* PARAM input operand to be reversed
* RETURN reversed bit pattern
* ------------------------------------------------------------ */
uint16_t __bit_rev16(uint16_t x) {
 
register uint16_t z = x;
register uint16_t y = 0;
uint8_t i = 0;
 
for (i=0; i<8; i++) { // two-times unrolled
asm volatile ("rrc %[a], %[b]" : [b] "=r" (z) : "[b]" (z), [a] "r" (z));
asm volatile ("rlc %[c], %[d]" : [d] "=r" (y) : "[d]" (y), [c] "r" (y));
 
asm volatile ("rrc %[a], %[b]" : [b] "=r" (z) : "[b]" (z), [a] "r" (z));
asm volatile ("rlc %[c], %[d]" : [d] "=r" (y) : "[d]" (y), [c] "r" (y));
}
return y;
}
 
 
/* ------------------------------------------------------------
* INFO Pseudo-random number generator
* RETURN 32-bit random data
* ------------------------------------------------------------ */
uint32_t __xorshift32(void) {
 
static uint32_t x32 = 314159265;
 
x32 ^= x32 << 13;
x32 ^= x32 >> 17;
x32 ^= x32 << 5;
 
return x32;
}
 
 
#endif // neo430_cpu_h
/sw/lib/neo430/neo430_usart.h
19,7 → 19,7
// # You should have received a copy of the GNU Lesser General Public License along with this #
// # source; if not, download it from https://www.gnu.org/licenses/lgpl-3.0.en.html #
// # ********************************************************************************************* #
// # Stephan Nolting, Hannover, Germany 21.07.2017 #
// # Stephan Nolting, Hannover, Germany 29.04.2018 #
// #################################################################################################
 
#ifndef neo430_usart_h
52,6 → 52,7
void uart_print_bin_dword(uint32_t dw);
void _itoa(uint32_t x);
void _printf(char *format, ...);
uint32_t hexstr_to_uint(char *buffer, uint8_t length);
 
 
/* ------------------------------------------------------------
453,4 → 454,34
}
 
 
/* ------------------------------------------------------------
* INFO Convert N hex chars into uint32
* PARAM Pointer to buffer with hex chars
* PARAM Number of hex chars to convert (1..8)
* RETURN Conversion result
* ------------------------------------------------------------ */
uint32_t hexstr_to_uint(char *buffer, uint8_t length) {
 
uint32_t res = 0, d = 0;
char c = 0;
 
while (length--) {
c = *buffer++;
 
if ((c >= '0') && (c <= '9'))
d = (uint32_t)(c - '0');
else if ((c >= 'a') && (c <= 'f'))
d = (uint32_t)((c - 'a') + 10);
else if ((c >= 'A') && (c <= 'F'))
d = (uint32_t)((c - 'A') + 10);
else
d = 0;
 
res = res + (d << (length*4));
}
 
return res;
}
 
 
#endif // neo430_usart_h

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.