URL
https://opencores.org/ocsvn/neo430/neo430/trunk
Subversion Repositories neo430
Compare Revisions
- This comparison shows the changes necessary to convert path
/neo430
- from Rev 187 to Rev 188
- ↔ Reverse comparison
Rev 187 → Rev 188
/trunk/neo430/LICENSE
1,9 → 1,3
################################################################################################# |
# < NEO430 License File > # |
# ********************************************************************************************* # |
# Stephan Nolting, Hannover, Germany 15.02.2020 # |
################################################################################################# |
|
GNU LESSER GENERAL PUBLIC LICENSE |
Version 3, 29 June 2007 |
|
/trunk/neo430/README.md
2,9 → 2,9
|
[![Build Status](https://travis-ci.com/stnolting/neo430.svg?branch=master)](https://travis-ci.com/stnolting/neo430) |
[![GitHub release](https://img.shields.io/github/v/release/stnolting/neo430?include_prereleases)](https://GitHub.com/stnolting/neo430/releases/) |
[![size](https://img.shields.io/github/repo-size/stnolting/neo430)](https://github.com/stnolting/neo430/archive/master.zip) |
[![last commit](https://img.shields.io/github/last-commit/stnolting/neo430)](https://github.com/stnolting/neo430/commits/master) |
[![issues](https://img.shields.io/github/issues/stnolting/neo430)](https://github.com/stnolting/neo430/issues) |
[![documentation](https://img.shields.io/badge/documentation-available-brightgreen)](https://raw.githubusercontent.com/stnolting/neo430/master/doc/NEO430.pdf) |
[![license](https://img.shields.io/github/license/stnolting/neo430)](https://github.com/stnolting/neo430/blob/master/LICENSE) |
|
## Table of Content |
/trunk/neo430/rtl/core/neo430_bootloader_image.vhd
968,9 → 968,9
000957 => x"420a", |
000958 => x"564c", |
000959 => x"203a", |
000960 => x"6546", |
000961 => x"2062", |
000962 => x"3131", |
000960 => x"614d", |
000961 => x"2072", |
000962 => x"3231", |
000963 => x"3220", |
000964 => x"3230", |
000965 => x"0a30", |
/trunk/neo430/rtl/core/neo430_timer.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 # |
-- # ********************************************************************************************* # |
-- # tephan Nolting, Hannover, Germany 16.01.2020 # |
-- # tephan Nolting, Hannover, Germany 04.03.2020 # |
-- ################################################################################################# |
|
library ieee; |
115,9 → 115,6
end if; |
end process wr_access; |
|
-- timer clock select -- |
prsc_tick <= clkgen_i(to_integer(unsigned(ctrl(ctrl_prsc2_bit_c downto ctrl_prsc0_bit_c)))); |
|
-- enable external clock generator -- |
clkgen_en_o <= ctrl(ctrl_en_bit_c); |
|
127,6 → 124,8
counter_update: process(clk_i) |
begin |
if rising_edge(clk_i) then |
-- clock_en buffer -- |
prsc_tick <= clkgen_i(to_integer(unsigned(ctrl(ctrl_prsc2_bit_c downto ctrl_prsc0_bit_c)))); |
-- irq edge detector -- |
irq_fire_ff <= irq_fire; |
-- counter update -- |
/trunk/neo430/rtl/core/neo430_top.vhd
235,7 → 235,7
end if; |
end process clock_generator_buf; |
|
-- clock enable select - rising edge detectors -- |
-- clock enable select: rising edge detectors -- |
clk_gen(clk_div2_c) <= clk_div(0) and (not clk_div_ff(0)); -- CLK/2 |
clk_gen(clk_div4_c) <= clk_div(1) and (not clk_div_ff(1)); -- CLK/4 |
clk_gen(clk_div8_c) <= clk_div(2) and (not clk_div_ff(2)); -- CLK/8 |
/trunk/neo430/rtl/core/neo430_wdt.vhd
25,7 → 25,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 15.01.2020 # |
-- # Stephan Nolting, Hannover, Germany 04.03.2020 # |
-- ################################################################################################# |
|
library ieee; |
125,12 → 125,17
end if; |
end process wdt_core; |
|
-- enable external clock generator -- |
clkgen_en_o <= enable; |
|
|
-- Counter Update ----------------------------------------------------------- |
-- ----------------------------------------------------------------------------- |
cnt_sync: process(clk_i) |
begin |
if rising_edge(clk_i) then |
-- clock_en buffer -- |
prsc_tick <= clkgen_i(to_integer(unsigned(clk_sel))); |
-- unauthorized access buffer -- |
fail_ff <= fail; |
-- reset synchronizer -- |
144,10 → 149,6
end if; |
end process cnt_sync; |
|
-- counter clock select -- |
clkgen_en_o <= enable; |
prsc_tick <= clkgen_i(to_integer(unsigned(clk_sel))); |
|
-- system reset -- |
rst_o <= rst_sync(1); |
|
/trunk/neo430/sw/bootloader/bootloader.c
4,12 → 4,12
// # Boot from IMEM, UART or SPI Flash at SPI.CS[0] # |
// # # |
// # UART configuration: 8N1 at 19200 baud # |
// # Boot Flash: 8-bit SPI, 24-bit addresses (e.g., Micron N25Q032A) @ SPI.CS[0] # |
// # GPIO.out[0] is used as high-active status LED # |
// # Boot Flash: 8-bit SPI, 24-bit addresses (like Micron N25Q032A) @ NEO430_SPI.CS[0] # |
// # NEO430_GPIO.out[0] is used as high-active status LED # |
// # # |
// # Auto boot sequence after timeout: # |
// # -> Try booting from SPI flash at SPI.CS[0] # |
// # -> permanently light up status led and freeze if SPI flash booting attempt fails # |
// # -> Permanently light up status led and freeze if SPI flash booting attempt fails # |
// # ********************************************************************************************* # |
// # This file is part of the NEO430 Processor project: https://github.com/stnolting/neo430 # |
// # Copyright by Stephan Nolting: stnolting@gmail.com # |
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 10.02.2020 # |
// # Stephan Nolting, Hannover, Germany 12.03.2020 # |
// ################################################################################################# |
|
// Libraries |
36,14 → 36,14
#include <stdint.h> |
#include <neo430.h> |
|
// SPI flash: NEO430 boot base address |
#define SPI_FLASH_BOOT_ADR 0x00040000L |
|
// Configuration |
#define BAUD_RATE 19200 // default UART baud rate |
#define AUTOBOOT_TIMEOUT 4 // countdown (seconds) to auto boot |
#define STATUS_LED 0 // GPIO.out(0) is status LED |
|
// SPI flash boot base address |
#define SPI_FLASH_BOOT_ADR 0x00040000L |
|
// SPI flash hardware configuration |
#define SPI_FLASH_CS 0 |
|
/trunk/neo430/sw/lib/neo430/include/neo430_uart.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 17.01.2020 # |
// # Stephan Nolting, Hannover, Germany 11.03.2020 # |
// ################################################################################################# |
|
#ifndef neo430_uart_h |
29,27 → 29,28
#include <stdarg.h> |
|
// prototypes |
void neo430_uart_setup(uint32_t baudrate); // activate and configure UART |
void neo430_uart_disable(void); // deactivate uart |
uint32_t neo430_uart_get_baudrate(void); // compute actual baudrate using UART's current configuration |
void neo430_uart_putc(char c); // send single char |
char neo430_uart_getc(void); // wait and read single char |
uint16_t neo430_uart_char_received(void); // test if a char has been received |
char neo430_uart_char_read(void); // get a received char |
void neo430_uart_print(char *s); // print a text string |
void neo430_uart_br_print(char *s); // print a text string and allow easy line breaks |
uint16_t neo430_uart_scan(char *buffer, uint16_t max_size, uint16_t echo); // read several chars into buffer |
void neo430_uart_print_hex_char(char c); // print byte as a hex char |
void neo430_uart_print_hex_byte(uint8_t b); // print byte as 2 hex numbers |
void neo430_uart_print_hex_word(uint16_t w); // print word as 4 hex numbers |
void neo430_uart_print_hex_dword(uint32_t dw); // print double word as 8 hex numbers |
void neo430_uart_print_bin_byte(uint8_t b); // print byte in binary form |
void neo430_uart_print_bin_word(uint16_t w); // print word in binary form |
void neo430_uart_print_bin_dword(uint32_t dw); // print double word in binary form |
void neo430_itoa(uint32_t x, const uint16_t leading_zeros, char *res); // convert double word to decimal number |
void neo430_printf(char *format, ...); // print format string |
void neo430_fp_print(int32_t num, const uint16_t fp); // print fixed point number |
uint32_t neo430_hexstr_to_uint(char *buffer, uint8_t length); // convert hex string to number |
void neo430_uart_bs(uint16_t n); // return terminal cursor n positions |
void neo430_uart_setup(uint32_t baudrate); // activate and configure UART |
void neo430_uart_disable(void); // deactivate uart |
uint32_t neo430_uart_get_baudrate(void); // compute actual baudrate using UART's current configuration |
void neo430_uart_putc(char c); // send single char |
char neo430_uart_getc(void); // wait and read single char |
uint16_t neo430_uart_char_received(void); // test if a char has been received |
char neo430_uart_char_read(void); // get a received char |
void neo430_uart_print(char *s); // print a text string |
void neo430_uart_br_print(char *s); // print a text string and allow easy line breaks |
uint16_t neo430_uart_scan(char *buffer, uint16_t max_size, uint16_t echo); // read several chars into buffer |
void neo430_uart_print_hex_char(char c); // print byte as a hex char |
void neo430_uart_print_hex_byte(uint8_t b); // print byte as 2 hex numbers |
void neo430_uart_print_hex_word(uint16_t w); // print word as 4 hex numbers |
void neo430_uart_print_hex_dword(uint32_t dw); // print double word as 8 hex numbers |
void neo430_uart_print_bin_byte(uint8_t b); // print byte in binary form |
void neo430_uart_print_bin_word(uint16_t w); // print word in binary form |
void neo430_uart_print_bin_dword(uint32_t dw); // print double word in binary form |
void neo430_itoa(uint32_t x, const uint16_t leading_zeros, char *res); // convert double word to decimal number |
void neo430_printf(char *format, ...); // print format string |
void neo430_fp_print(int32_t num, const uint16_t fp); // print fixed point number |
uint32_t neo430_hexstr_to_uint(char *buffer, uint8_t length); // convert hex string to number |
void neo430_uart_bs(uint16_t n); // return terminal cursor n positions |
void neo430_uart_print_fpf_32(int32_t num, const int fpf_c, const int num_frac_digits_c); // print fixed-point number |
|
#endif // neo430_uart_h |
/trunk/neo430/sw/lib/neo430/source/neo430_uart.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.02.2020 # |
// # Stephan Nolting, Hannover, Germany 11.03.2020 # |
// ################################################################################################# |
|
#include "neo430.h" |
493,3 → 493,61
} |
} |
|
|
/* ------------------------------------------------------------ |
* INFO Print signed 32-bit fixed point number (num) |
* PARAM fpf_c: Number of bin fractional bits in input (max 32) |
* PARAM num_frac_digits_c: Number of fractional digits to show (max 8) |
* ------------------------------------------------------------ */ |
void neo430_uart_print_fpf_32(int32_t num, const int fpf_c, const int num_frac_digits_c) { |
|
char string_buf[11]; |
int i; |
|
|
// make positive |
if (num < 0) { |
neo430_uart_putc('-'); |
num = -num; |
} |
uint32_t num_int = (uint32_t)num; |
|
|
// compute resolution |
uint32_t frac_dec_base = 1; |
for (i=0; i<num_frac_digits_c; i++) { |
frac_dec_base *= 10; |
} |
frac_dec_base >>= 1; |
|
|
// print integer part |
uint32_t int_data = num_int >> fpf_c; |
neo430_itoa((uint32_t)int_data, 0, string_buf); |
neo430_uart_br_print(string_buf); |
|
|
// compute fractional part's shift mask |
uint32_t frac_dec_mask = 1; |
for (i=0; i<fpf_c-1; i++) { |
frac_dec_mask <<= 1; |
} |
|
// compute actual fractional part |
uint32_t frac_data = num_int & ((1 << fpf_c)-1); |
uint32_t frac_sum = 0; |
for (i=0; i<fpf_c; i++) { |
|
if (frac_data & frac_dec_mask) { // frac bit set? |
frac_sum += frac_dec_base; |
} |
frac_dec_mask >>= 1; // got from MSB to LSB |
frac_dec_base >>= 1; |
} |
|
// print fractional part |
neo430_uart_putc('.'); |
neo430_itoa((uint32_t)frac_sum, num_frac_digits_c-1, string_buf); |
neo430_uart_br_print(string_buf); |
} |
|
/trunk/neo430/travis_ci/hw_check.sh
57,7 → 57,7
|
# Check output |
uart_res_reference="Blinking LED demo program" |
echo "Checking UART output. Should be" $uart_res_reference |
echo "Checking UART output. Should be:" $uart_res_reference |
echo "UART output is:" |
cat neo430.uart_tx.txt |
grep -q "$uart_res_reference" neo430.uart_tx.txt |