---
title: "WIZnet W5300 driver sample for Altera NiosII"
url: "https://maker.wiznet.io/josephsr/projects/wiznet-w5300-driver-sample-for-altera-niosii/"
markdown_url: "https://maker.wiznet.io/josephsr/projects/wiznet-w5300-driver-sample-for-altera-niosii/md"
type: "UCC: User Created Content"
author: "Kazunori Sato"
author_url: "https://github.com/kazunori279/hdllesson/tree/master/Wiz"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Kazunori Sato"
original_url: "https://github.com/kazunori279/hdllesson/tree/master/Wiz"
published: "2024-02-05"
language: "en"
hardware: ["WIZnet W5300"]
likes: 0
views: 330
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# WIZnet W5300 driver sample for Altera NiosII

> The files under this folder are driver sample code for WIZnet W3500 TCP processor. The code is copied from the original driver sample provided by WIZnet, simpli

Original author: Kazunori Sato (source: https://github.com/kazunori279/hdllesson/tree/master/Wiz)

## Components

- **WIZnet W5300** x 1 ([docs](https://docs.wiznet.io/Product/Chip/Ethernet/W5300))

## Documents and links

- [hdllesson](https://github.com/kazunori279/hdllesson/tree/master/Wiz) (code)

## Article

- HW spec
  - Altera DE0
  - wiz830mj (w5300)

Use altera DE0 with wiz830mj

![Screen Shot 2014-11-10 at 0.22.30.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F38290%2Fb5d80cf2-bf12-41b5-3900-b800589d8b7b.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=438f837e68444ff73a1fea2a7558373b)

control w5300 with avalon MM slave translator

![Screen Shot 2014-11-10 at 0.42.55.png](https://qiita-user-contents.imgix.net/https%3A%2F%2Fqiita-image-store.s3.amazonaws.com%2F0%2F38290%2F9fa9fcb2-3a00-d096-2234-95ee6f860566.png?ixlib=rb-4.0.0&auto=format&gif-q=60&q=75&s=2a34fbe658fd23a1c2a6994388126c90)

**function mapping**

nios2e u0 (
.clk_clk (CLK),
.reset_reset_n (RST_N),
.wiz0_address (WIZ_A),
.wiz0_write (wiz_wr),
.wiz0_read (wiz_rd),
.wiz0_readdata (wiz_readdata),
.wiz0_writedata (wiz_writedata),
.wiz0_chipselect (wiz_cs),
.wiz0_byteenable (wiz_byteenable)
);

wire [15:0] wiz_readdata;
wire [15:0] wiz_writedata;
wire [1:0] wiz_byteenable;
wire wiz_cs, wiz_wr, wiz_rd;
assign WIZ_CS_N = !wiz_cs;
assign WIZ_WR_N = !(wiz_wr && wiz_byteenable[0] && wiz_byteenable[1]);
assign WIZ_RD_N = !(wiz_rd && wiz_byteenable[0] && wiz_byteenable[1]);
assign WIZ_D = (!WIZ_CS_N && !WIZ_WR_N) ? wiz_writedata : 15'bz;
assign wiz_readdata = (!WIZ_CS_N && !WIZ_RD_N) ? WIZ_D : 15'b0;

**set w5300**

setSIPR({ 192, 168, 1, 250 }); // set source IP address
setGAR({ 192, 168, 1, 1 }); // set gateway IP address
setSUBR({ 255, 255, 255, 0 }); // set subnet mask address
setSHAR({ 0x00, 0x08, 0xDC, 0x00, 111, 200 }); // set source hardware address
...

loopback_tcps(0, 5000, data_buf, 0);

---

Source: https://maker.wiznet.io/josephsr/projects/wiznet-w5300-driver-sample-for-altera-niosii/
