OpenCores
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 166 to Rev 167
    Reverse comparison

Rev 166 → Rev 167

/trunk/doc/NEO430.pdf Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
/trunk/doc/instruction_set.pdf Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
trunk/doc/instruction_set.pdf Property changes : Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Index: trunk/rtl/core/neo430_package.vhd =================================================================== --- trunk/rtl/core/neo430_package.vhd (revision 166) +++ trunk/rtl/core/neo430_package.vhd (revision 167) @@ -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 23.09.2019 # +-- # Stephan Nolting, Hannover, Germany 05.10.2019 # -- ################################################################################################# library ieee; @@ -30,7 +30,7 @@ -- Processor Hardware Version ------------------------------------------------------------- -- ------------------------------------------------------------------------------------------- - constant hw_version_c : std_ulogic_vector(15 downto 0) := x"0300"; -- no touchy! + constant hw_version_c : std_ulogic_vector(15 downto 0) := x"0301"; -- no touchy! -- Advanced Hardware Configuration -------------------------------------------------------- -- -------------------------------------------------------------------------------------------
/trunk/rtl/core/neo430_twi.vhd
1,8 → 1,8
-- #################################################################################################
-- # << NEO430 - Two Wire Serial Interface (I2C) >> #
-- # ********************************************************************************************* #
-- # Supports START and STOP condition and 8 bit data + ACK/NACK transfers. #
-- # No multi-master support! No clock stretching support yet! #
-- # Supports START and STOP conditions, 8 bit data + ACK/NACK transfers and clock stretching. #
-- # No multi-master support yet! #
-- # Interrupt: TWI_transfer_done #
-- # ********************************************************************************************* #
-- # This file is part of the NEO430 Processor project: https://github.com/stnolting/neo430 #
23,7 → 23,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.11.2018 #
-- # Stephan Nolting, Hannover, Germany 05.10.2019 #
-- #################################################################################################
 
library ieee;
83,6 → 83,9
signal twi_phase_gen : std_ulogic_vector(3 downto 0);
signal twi_clk_phase : std_ulogic_vector(3 downto 0);
 
-- twi clock stretching --
signal twi_clk_halt : std_ulogic;
 
-- twi transceiver core --
signal ctrl : std_ulogic_vector(7 downto 0); -- unit's control register
signal arbiter : std_ulogic_vector(2 downto 0);
134,7 → 137,7
if (arbiter(2) = '0') or (arbiter = "100") then -- offline or idle
twi_phase_gen <= "0001"; -- make sure to start with a new phase, 0,1,2,3 stepping
else
if (twi_clk = '1') then
if (twi_clk = '1') and (twi_clk_halt = '0') then -- enabled and no clock stretching detected
twi_phase_gen <= twi_phase_gen(2 downto 0) & twi_phase_gen(3); -- shift left
end if;
end if;
221,7 → 224,7
twi_scl_o <= '0';
twi_sda_o <= twi_rtx_sreg(8); -- MSB first
elsif (twi_clk_phase(1) = '1') then -- first half + second half of valid data strobe
twi_scl_o <= '1';
twi_scl_o <= '1';
elsif (twi_clk_phase(3) = '1') then
twi_rtx_sreg <= twi_rtx_sreg(7 downto 0) & twi_sda_i_ff1; -- sample and shift left
twi_scl_o <= '0';
242,6 → 245,22
end process twi_rtx_unit;
 
 
-- Clock Stretching Detector ------------------------------------------------
-- -----------------------------------------------------------------------------
clock_stretching: process(arbiter, twi_scl_o, twi_scl_i_ff1)
begin
-- clock stretching can occur during data transmission and even during
-- a START or STOP condition
if (arbiter(2) = '1') and -- module enabled
(twi_scl_o = '1') and -- master wants to pull scl high
(twi_scl_i_ff1 = '0') then -- but scl is pulled low by slave
twi_clk_halt <= '1';
else
twi_clk_halt <= '0';
end if;
end process clock_stretching;
 
 
-- Read access --------------------------------------------------------------
-- -----------------------------------------------------------------------------
rd_access: process(clk_i)
/trunk/sim/ISIM/neo430_tb.wcfg
12,15 → 12,15
</db_ref>
</db_ref_list>
<zoom_setting>
<ZoomStartTime time="295779200000fs"></ZoomStartTime>
<ZoomEndTime time="295823400001fs"></ZoomEndTime>
<Cursor1Time time="295822400000fs"></Cursor1Time>
<ZoomStartTime time="295936666667fs"></ZoomStartTime>
<ZoomEndTime time="301326666668fs"></ZoomEndTime>
<Cursor1Time time="298031667000fs"></Cursor1Time>
</zoom_setting>
<column_width_setting>
<NameColumnWidth column_width="167"></NameColumnWidth>
<ValueColumnWidth column_width="81"></ValueColumnWidth>
<ValueColumnWidth column_width="77"></ValueColumnWidth>
</column_width_setting>
<WVObjectSize size="128" />
<WVObjectSize size="119" />
<wvobject type="divider" fp_name="divider6">
<obj_property name="label">Global</obj_property>
<obj_property name="DisplayName">label</obj_property>
466,10 → 466,6
<obj_property name="label">IO: TWI</obj_property>
<obj_property name="DisplayName">label</obj_property>
</wvobject>
<wvobject fp_name="/neo430_tb/neo430_top_inst/neo430_twi_inst_true/neo430_twi_inst/clk_i" type="logic">
<obj_property name="ElementShortName">clk_i</obj_property>
<obj_property name="ObjectShortName">clk_i</obj_property>
</wvobject>
<wvobject fp_name="/neo430_tb/neo430_top_inst/neo430_twi_inst_true/neo430_twi_inst/data_i" type="array">
<obj_property name="ElementShortName">data_i[15:0]</obj_property>
<obj_property name="ObjectShortName">data_i[15:0]</obj_property>
490,16 → 486,6
<obj_property name="ElementShortName">twi_clk</obj_property>
<obj_property name="ObjectShortName">twi_clk</obj_property>
</wvobject>
<wvobject fp_name="/neo430_tb/neo430_top_inst/neo430_twi_inst_true/neo430_twi_inst/twi_phase_gen" type="array">
<obj_property name="ElementShortName">twi_phase_gen[3:0]</obj_property>
<obj_property name="ObjectShortName">twi_phase_gen[3:0]</obj_property>
<obj_property name="Radix">BINARYRADIX</obj_property>
</wvobject>
<wvobject fp_name="/neo430_tb/neo430_top_inst/neo430_twi_inst_true/neo430_twi_inst/twi_clk_phase" type="array">
<obj_property name="ElementShortName">twi_clk_phase[3:0]</obj_property>
<obj_property name="ObjectShortName">twi_clk_phase[3:0]</obj_property>
<obj_property name="Radix">BINARYRADIX</obj_property>
</wvobject>
<wvobject fp_name="/neo430_tb/neo430_top_inst/neo430_twi_inst_true/neo430_twi_inst/arbiter" type="array">
<obj_property name="ElementShortName">arbiter[2:0]</obj_property>
<obj_property name="ObjectShortName">arbiter[2:0]</obj_property>
/trunk/sw/example/twi_test/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 11.03.2019 #
// # Stephan Nolting, Hannover, Germany 10.10.2019 #
// #################################################################################################
 
 
90,7 → 90,7
neo430_twi_generate_start(); // generate START condition
}
else if (!strcmp(buffer, "stop")) {
neo430_twi_stop_trans(); // generate STOP condition
neo430_twi_generate_stop(); // generate STOP condition
}
else if (!strcmp(buffer, "scan")) {
scan_twi();
167,7 → 167,7
uint8_t i, num_devices = 0;
for (i=0; i<128; i++) {
uint8_t twi_ack = neo430_twi_start_trans((uint8_t)(2*i+1));
neo430_twi_stop_trans();
neo430_twi_generate_stop();
 
if (twi_ack == 0) {
neo430_uart_br_print(" * Found device at address (shifted left by 1 bit): 0x");
/trunk/sw/example/wb_terminal/main.c
22,7 → 22,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.11.2018 #
// # Stephan Nolting, Hannover, Germany 10.10.2019 #
// #################################################################################################
 
 
224,7 → 224,7
else if (wb_config == 2)
neo430_uart_print_hex_word(neo430_wishbone32_get_data16(address));
else if (wb_config == 4)
neo430_uart_print_hex_dword(neo430_wishbone32_get_data32(address));
neo430_uart_print_hex_dword(neo430_wishbone32_get_data32());
 
neo430_uart_br_print("\n");
}
331,7 → 331,7
address += 2;
}
else if (wb_config == 4) {
neo430_uart_print_hex_dword(neo430_wishbone32_get_data32(address));
neo430_uart_print_hex_dword(neo430_wishbone32_get_data32());
address += 4;
}
 
/trunk/sw/lib/neo430/include/neo430_spi.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 19.01.2019 #
// # Stephan Nolting, Hannover, Germany 04.10.2019 #
// #################################################################################################
 
#ifndef neo430_spi_h
29,7 → 29,7
void neo430_spi_enable(uint8_t prsc); // configure and activate SPI module
void neo430_spi_disable(void); // deactivate SPI module
void neo430_spi_cs_en(uint8_t cs); // activate slave
void neo430_spi_cs_dis(uint8_t cs); // deactivate slave
void neo430_spi_cs_dis(void); // deactivate all slaves
uint8_t neo430_spi_trans(uint8_t d); // RTX transfer
 
#endif // neo430_spi_h
/trunk/sw/lib/neo430/include/neo430_twi.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.11.2018 #
// # Stephan Nolting, Hannover, Germany 10.10.2019 #
// #################################################################################################
 
#ifndef neo430_twi_h
31,7 → 31,7
uint8_t neo430_twi_start_trans(uint8_t a); // start transmission (START) and send address and r/w bit
uint8_t neo430_twi_trans(uint8_t d); // send byte to active slave
uint8_t neo430_twi_get_data(void); // get last received data byte
void neo430_twi_stop_trans(void); // stop transmission (STOP)
void neo430_twi_generate_stop(void); // stop transmission (STOP)
void neo430_twi_generate_start(void); // generate start condition
 
#endif // neo430_twi_h
/trunk/sw/lib/neo430/include/neo430_wishbone.h
24,7 → 24,7
// # source; if not, download it from https://www.gnu.org/licenses/lgpl-3.0.en.html #
// # ********************************************************************************************* #
// # Thanks to Edward Sherriff! #
// # Stephan Nolting, Hannover, Germany 18.01.2019 #
// # Stephan Nolting, Hannover, Germany 04.10.2019 #
// #################################################################################################
 
#ifndef neo430_wishbone_h
50,7 → 50,7
void neo430_wishbone32_read8_start(uint32_t a);
void neo430_wishbone32_write8_start(uint32_t a, uint8_t d); // This function performs a data alignment based on the address!
 
uint32_t neo430_wishbone32_get_data32(uint32_t a);
uint32_t neo430_wishbone32_get_data32(void);
uint16_t neo430_wishbone32_get_data16(uint32_t a); // This function performs a data alignment based on the address!
uint8_t neo430_wishbone32_get_data8(uint32_t a); // This function performs a data alignment based on the address!
 
63,7 → 63,7
// prototypes non-blocking functions for 32-bit data bus width using NO ADDRESS ALIGNMENT
void neo430_wishbone32_read_start(uint32_t a);
void neo430_wishbone32_write_start(uint32_t a, uint32_t d);
uint32_t neo430_wishbone32_get_data(uint32_t a);
uint32_t neo430_wishbone32_get_data(void);
 
// -------------
 
74,7 → 74,7
// prototypes non-blocking functions for 16-bit data bus width using NO ADDRESS ALIGNMENT
void neo430_wishbone16_read_start(uint32_t a);
void neo430_wishbone16_write_start(uint32_t a, uint16_t d);
uint16_t neo430_wishbone16_get_data(uint32_t a);
uint16_t neo430_wishbone16_get_data(void);
 
// -------------
 
85,7 → 85,7
// prototypes non-blocking functions for 8-bit data bus width using NO ADDRESS ALIGNMENT
void neo430_wishbone8_read_start(uint32_t a);
void neo430_wishbone8_write_start(uint32_t a, uint8_t d);
uint8_t neo430_wishbone8_get_data8(uint32_t a);
uint8_t neo430_wishbone8_get_data8(void);
 
// -------------
 
/trunk/sw/lib/neo430/source/neo430_spi.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 13.03.2019 #
// # Stephan Nolting, Hannover, Germany 04.10.2019 #
// #################################################################################################
 
#include "neo430.h"
67,10 → 67,9
 
 
/* ------------------------------------------------------------
* INFO Disable SPI CSx (set high)
* PARAM CS line (0..7)
* INFO Disable all SPI CSx (set high)
* ------------------------------------------------------------ */
void neo430_spi_cs_dis(uint8_t cs) {
void neo430_spi_cs_dis(void) {
 
SPI_CT &= ~(1 << SPI_CT_CS_SET);
}
/trunk/sw/lib/neo430/source/neo430_twi.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 13.03.2019 #
// # Stephan Nolting, Hannover, Germany 10.10.2019 #
// #################################################################################################
 
#include "neo430.h"
97,7 → 97,7
/* ------------------------------------------------------------
* INFO Generate STOP condition
* ------------------------------------------------------------ */
void neo430_twi_stop_trans(void) {
void neo430_twi_generate_stop(void) {
 
TWI_CT |= (1 << TWI_CT_STOP); // generate STOP condition
while(TWI_CT & (1 << TWI_CT_BUSY)); // wait until idle again
/trunk/sw/lib/neo430/source/neo430_wishbone.c
24,7 → 24,7
// # source; if not, download it from https://www.gnu.org/licenses/lgpl-3.0.en.html #
// # ********************************************************************************************* #
// # Thanks to Edward Sherriff! #
// # Stephan Nolting, Hannover, Germany 13.03.2019 #
// # Stephan Nolting, Hannover, Germany 04.10.2019 #
// #################################################################################################
 
#include "neo430.h"
300,10 → 300,9
 
/* ------------------------------------------------------------
* INFO Read 32-bit data after nonblocking transaction has been started
* PARAM 32-bit device address
* RETURN read data
* ------------------------------------------------------------ */
uint32_t neo430_wishbone32_get_data32(uint32_t a) {
uint32_t neo430_wishbone32_get_data32(void) {
 
return WB32_D_32bit;
}
433,7 → 432,7
* PARAM 32-bit device address
* RETURN 32-bit read data
* ------------------------------------------------------------ */
uint32_t neo430_wishbone32_get_data(uint32_t a) {
uint32_t neo430_wishbone32_get_data(void) {
 
return WB32_D_32bit;
}
525,10 → 524,9
 
/* ------------------------------------------------------------
* INFO Read 16-bit data after nonblocking transaction has been started
* PARAM 32-bit device address
* RETURN 16-bit read data
* ------------------------------------------------------------ */
uint16_t neo430_wishbone16_get_data(uint32_t a) {
uint16_t neo430_wishbone16_get_data(void) {
 
return WB32_LD;
}
620,10 → 618,9
 
/* ------------------------------------------------------------
* INFO Read 8-bit data after nonblocking transaction has been started
* PARAM 32-bit device address
* RETURN 8-bit read data
* ------------------------------------------------------------ */
uint8_t neo430_wishbone8_get_data(uint32_t a) {
uint8_t neo430_wishbone8_get_data(void) {
 
return (uint8_t)WB32_LD;
}

powered by: WebSVN 2.1.0

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