cpu32

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 2fa71e82ffedabea0088a7f32554139f1f7cf65a
parent d6cc6079f42aa2410ea789674a914ce9b4354225
Author: Brian Swetland <swetland@frotz.net>
Date:   Sun,  5 Feb 2012 19:00:47 -0800

de0nano - quartus project for terasic DE0 Nano - Cyclone IV board

Diffstat:
Ade0nano/aram.v | 172+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ade0nano/de0nano.qpf | 6++++++
Ade0nano/de0nano.qsf | 234+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ade0nano/de0nano.sdc | 85+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ade0nano/de0nano.v | 116+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ade0nano/fw.s | 36++++++++++++++++++++++++++++++++++++
6 files changed, 649 insertions(+), 0 deletions(-)

diff --git a/de0nano/aram.v b/de0nano/aram.v @@ -0,0 +1,172 @@ +// megafunction wizard: %RAM: 1-PORT% +// GENERATION: STANDARD +// VERSION: WM1.0 +// MODULE: altsyncram + +// ============================================================ +// File Name: aram.v +// Megafunction Name(s): +// altsyncram +// +// Simulation Library Files(s): +// altera_mf +// ============================================================ +// ************************************************************ +// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE! +// +// 11.1 Build 216 11/23/2011 SP 1 SJ Web Edition +// ************************************************************ + + +//Copyright (C) 1991-2011 Altera Corporation +//Your use of Altera Corporation's design tools, logic functions +//and other software and tools, and its AMPP partner logic +//functions, and any output files from any of the foregoing +//(including device programming or simulation files), and any +//associated documentation or information are expressly subject +//to the terms and conditions of the Altera Program License +//Subscription Agreement, Altera MegaCore Function License +//Agreement, or other applicable license agreement, including, +//without limitation, that your use is for the sole purpose of +//programming logic devices manufactured by Altera and sold by +//Altera or its authorized distributors. Please refer to the +//applicable agreement for further details. + + +// synopsys translate_off +`timescale 1 ps / 1 ps +// synopsys translate_on +module aram ( + address, + clock, + data, + wren, + q); + + input [8:0] address; + input clock; + input [31:0] data; + input wren; + output [31:0] q; +`ifndef ALTERA_RESERVED_QIS +// synopsys translate_off +`endif + tri1 clock; +`ifndef ALTERA_RESERVED_QIS +// synopsys translate_on +`endif + + wire [31:0] sub_wire0; + wire [31:0] q = sub_wire0[31:0]; + + altsyncram altsyncram_component ( + .address_a (address), + .clock0 (clock), + .data_a (data), + .wren_a (wren), + .q_a (sub_wire0), + .aclr0 (1'b0), + .aclr1 (1'b0), + .address_b (1'b1), + .addressstall_a (1'b0), + .addressstall_b (1'b0), + .byteena_a (1'b1), + .byteena_b (1'b1), + .clock1 (1'b1), + .clocken0 (1'b1), + .clocken1 (1'b1), + .clocken2 (1'b1), + .clocken3 (1'b1), + .data_b (1'b1), + .eccstatus (), + .q_b (), + .rden_a (1'b1), + .rden_b (1'b1), + .wren_b (1'b0)); + defparam + altsyncram_component.clock_enable_input_a = "BYPASS", + altsyncram_component.clock_enable_output_a = "BYPASS", + altsyncram_component.intended_device_family = "Cyclone IV E", + altsyncram_component.lpm_hint = "ENABLE_RUNTIME_MOD=NO", + altsyncram_component.lpm_type = "altsyncram", + altsyncram_component.numwords_a = 512, + altsyncram_component.operation_mode = "SINGLE_PORT", + altsyncram_component.outdata_aclr_a = "NONE", + altsyncram_component.outdata_reg_a = "CLOCK0", + altsyncram_component.power_up_uninitialized = "FALSE", + altsyncram_component.read_during_write_mode_port_a = "DONT_CARE", + altsyncram_component.widthad_a = 9, + altsyncram_component.width_a = 32, + altsyncram_component.width_byteena_a = 1; + + +endmodule + +// ============================================================ +// CNX file retrieval info +// ============================================================ +// Retrieval info: PRIVATE: ADDRESSSTALL_A NUMERIC "0" +// Retrieval info: PRIVATE: AclrAddr NUMERIC "0" +// Retrieval info: PRIVATE: AclrByte NUMERIC "0" +// Retrieval info: PRIVATE: AclrData NUMERIC "0" +// Retrieval info: PRIVATE: AclrOutput NUMERIC "0" +// Retrieval info: PRIVATE: BYTE_ENABLE NUMERIC "0" +// Retrieval info: PRIVATE: BYTE_SIZE NUMERIC "8" +// Retrieval info: PRIVATE: BlankMemory NUMERIC "1" +// Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_A NUMERIC "0" +// Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_A NUMERIC "0" +// Retrieval info: PRIVATE: Clken NUMERIC "0" +// Retrieval info: PRIVATE: DataBusSeparated NUMERIC "1" +// Retrieval info: PRIVATE: IMPLEMENT_IN_LES NUMERIC "0" +// Retrieval info: PRIVATE: INIT_FILE_LAYOUT STRING "PORT_A" +// Retrieval info: PRIVATE: INIT_TO_SIM_X NUMERIC "0" +// Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E" +// Retrieval info: PRIVATE: JTAG_ENABLED NUMERIC "0" +// Retrieval info: PRIVATE: JTAG_ID STRING "NONE" +// Retrieval info: PRIVATE: MAXIMUM_DEPTH NUMERIC "0" +// Retrieval info: PRIVATE: MIFfilename STRING "" +// Retrieval info: PRIVATE: NUMWORDS_A NUMERIC "512" +// Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "0" +// Retrieval info: PRIVATE: READ_DURING_WRITE_MODE_PORT_A NUMERIC "2" +// Retrieval info: PRIVATE: RegAddr NUMERIC "1" +// Retrieval info: PRIVATE: RegData NUMERIC "1" +// Retrieval info: PRIVATE: RegOutput NUMERIC "1" +// Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0" +// Retrieval info: PRIVATE: SingleClock NUMERIC "1" +// Retrieval info: PRIVATE: UseDQRAM NUMERIC "1" +// Retrieval info: PRIVATE: WRCONTROL_ACLR_A NUMERIC "0" +// Retrieval info: PRIVATE: WidthAddr NUMERIC "9" +// Retrieval info: PRIVATE: WidthData NUMERIC "32" +// Retrieval info: PRIVATE: rden NUMERIC "0" +// Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all +// Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_A STRING "BYPASS" +// Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_A STRING "BYPASS" +// Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone IV E" +// Retrieval info: CONSTANT: LPM_HINT STRING "ENABLE_RUNTIME_MOD=NO" +// Retrieval info: CONSTANT: LPM_TYPE STRING "altsyncram" +// Retrieval info: CONSTANT: NUMWORDS_A NUMERIC "512" +// Retrieval info: CONSTANT: OPERATION_MODE STRING "SINGLE_PORT" +// Retrieval info: CONSTANT: OUTDATA_ACLR_A STRING "NONE" +// Retrieval info: CONSTANT: OUTDATA_REG_A STRING "CLOCK0" +// Retrieval info: CONSTANT: POWER_UP_UNINITIALIZED STRING "FALSE" +// Retrieval info: CONSTANT: READ_DURING_WRITE_MODE_PORT_A STRING "DONT_CARE" +// Retrieval info: CONSTANT: WIDTHAD_A NUMERIC "9" +// Retrieval info: CONSTANT: WIDTH_A NUMERIC "32" +// Retrieval info: CONSTANT: WIDTH_BYTEENA_A NUMERIC "1" +// Retrieval info: USED_PORT: address 0 0 9 0 INPUT NODEFVAL "address[8..0]" +// Retrieval info: USED_PORT: clock 0 0 0 0 INPUT VCC "clock" +// Retrieval info: USED_PORT: data 0 0 32 0 INPUT NODEFVAL "data[31..0]" +// Retrieval info: USED_PORT: q 0 0 32 0 OUTPUT NODEFVAL "q[31..0]" +// Retrieval info: USED_PORT: wren 0 0 0 0 INPUT NODEFVAL "wren" +// Retrieval info: CONNECT: @address_a 0 0 9 0 address 0 0 9 0 +// Retrieval info: CONNECT: @clock0 0 0 0 0 clock 0 0 0 0 +// Retrieval info: CONNECT: @data_a 0 0 32 0 data 0 0 32 0 +// Retrieval info: CONNECT: @wren_a 0 0 0 0 wren 0 0 0 0 +// Retrieval info: CONNECT: q 0 0 32 0 @q_a 0 0 32 0 +// Retrieval info: GEN_FILE: TYPE_NORMAL aram.v TRUE +// Retrieval info: GEN_FILE: TYPE_NORMAL aram.inc FALSE +// Retrieval info: GEN_FILE: TYPE_NORMAL aram.cmp FALSE +// Retrieval info: GEN_FILE: TYPE_NORMAL aram.bsf FALSE +// Retrieval info: GEN_FILE: TYPE_NORMAL aram_inst.v FALSE +// Retrieval info: GEN_FILE: TYPE_NORMAL aram_bb.v TRUE +// Retrieval info: LIB_FILE: altera_mf diff --git a/de0nano/de0nano.qpf b/de0nano/de0nano.qpf @@ -0,0 +1,6 @@ +DATE = "18:10:22 February 03, 2012" +QUARTUS_VERSION = "10.1" + +# Revisions + +PROJECT_REVISION = "de0nano" diff --git a/de0nano/de0nano.qsf b/de0nano/de0nano.qsf @@ -0,0 +1,233 @@ +#============================================================ +# Build by Terasic System Builder +#============================================================ + +set_global_assignment -name FAMILY "Cyclone IV E" +set_global_assignment -name DEVICE EP4CE22F17C6 +set_global_assignment -name TOP_LEVEL_ENTITY "de0nano" +set_global_assignment -name ORIGINAL_QUARTUS_VERSION 10.1 +set_global_assignment -name LAST_QUARTUS_VERSION 11.1 +set_global_assignment -name PROJECT_CREATION_TIME_DATE "18:10:22 FEBRUARY 03,2012" +set_global_assignment -name DEVICE_FILTER_PACKAGE FBGA +set_global_assignment -name DEVICE_FILTER_PIN_COUNT 256 +set_global_assignment -name DEVICE_FILTER_SPEED_GRADE 6 +set_global_assignment -name CYCLONEII_RESERVE_NCEO_AFTER_CONFIGURATION "USE AS REGULAR IO" + +#============================================================ +# CLOCK +#============================================================ +set_location_assignment PIN_R8 -to CLOCK_50 +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to CLOCK_50 + +#============================================================ +# LED +#============================================================ +set_location_assignment PIN_A15 -to LED[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[0] +set_location_assignment PIN_A13 -to LED[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[1] +set_location_assignment PIN_B13 -to LED[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[2] +set_location_assignment PIN_A11 -to LED[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[3] +set_location_assignment PIN_D1 -to LED[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[4] +set_location_assignment PIN_F3 -to LED[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[5] +set_location_assignment PIN_B1 -to LED[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[6] +set_location_assignment PIN_L3 -to LED[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to LED[7] + +#============================================================ +# KEY +#============================================================ +set_location_assignment PIN_J15 -to KEY[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to KEY[0] +set_location_assignment PIN_E1 -to KEY[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to KEY[1] + +#============================================================ +# SW +#============================================================ +set_location_assignment PIN_M1 -to SW[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SW[0] +set_location_assignment PIN_T8 -to SW[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SW[1] +set_location_assignment PIN_B9 -to SW[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SW[2] +set_location_assignment PIN_M15 -to SW[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to SW[3] + +#============================================================ +# SDRAM +#============================================================ +set_location_assignment PIN_M7 -to DRAM_BA[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_BA[0] +set_location_assignment PIN_M6 -to DRAM_BA[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_BA[1] +set_location_assignment PIN_R6 -to DRAM_DQM[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQM[0] +set_location_assignment PIN_T5 -to DRAM_DQM[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQM[1] +set_location_assignment PIN_L2 -to DRAM_RAS_N +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_RAS_N +set_location_assignment PIN_L1 -to DRAM_CAS_N +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_CAS_N +set_location_assignment PIN_L7 -to DRAM_CKE +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_CKE +set_location_assignment PIN_R4 -to DRAM_CLK +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_CLK +set_location_assignment PIN_C2 -to DRAM_WE_N +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_WE_N +set_location_assignment PIN_P6 -to DRAM_CS_N +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_CS_N +set_location_assignment PIN_G2 -to DRAM_DQ[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[0] +set_location_assignment PIN_G1 -to DRAM_DQ[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[1] +set_location_assignment PIN_L8 -to DRAM_DQ[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[2] +set_location_assignment PIN_K5 -to DRAM_DQ[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[3] +set_location_assignment PIN_K2 -to DRAM_DQ[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[4] +set_location_assignment PIN_J2 -to DRAM_DQ[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[5] +set_location_assignment PIN_J1 -to DRAM_DQ[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[6] +set_location_assignment PIN_R7 -to DRAM_DQ[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[7] +set_location_assignment PIN_T4 -to DRAM_DQ[8] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[8] +set_location_assignment PIN_T2 -to DRAM_DQ[9] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[9] +set_location_assignment PIN_T3 -to DRAM_DQ[10] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[10] +set_location_assignment PIN_R3 -to DRAM_DQ[11] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[11] +set_location_assignment PIN_R5 -to DRAM_DQ[12] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[12] +set_location_assignment PIN_P3 -to DRAM_DQ[13] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[13] +set_location_assignment PIN_N3 -to DRAM_DQ[14] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[14] +set_location_assignment PIN_K1 -to DRAM_DQ[15] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_DQ[15] +set_location_assignment PIN_P2 -to DRAM_ADDR[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[0] +set_location_assignment PIN_N5 -to DRAM_ADDR[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[1] +set_location_assignment PIN_N6 -to DRAM_ADDR[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[2] +set_location_assignment PIN_M8 -to DRAM_ADDR[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[3] +set_location_assignment PIN_P8 -to DRAM_ADDR[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[4] +set_location_assignment PIN_T7 -to DRAM_ADDR[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[5] +set_location_assignment PIN_N8 -to DRAM_ADDR[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[6] +set_location_assignment PIN_T6 -to DRAM_ADDR[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[7] +set_location_assignment PIN_R1 -to DRAM_ADDR[8] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[8] +set_location_assignment PIN_P1 -to DRAM_ADDR[9] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[9] +set_location_assignment PIN_N2 -to DRAM_ADDR[10] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[10] +set_location_assignment PIN_N1 -to DRAM_ADDR[11] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[11] +set_location_assignment PIN_L4 -to DRAM_ADDR[12] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to DRAM_ADDR[12] + +#============================================================ +# EEPROM +#============================================================ +set_location_assignment PIN_F2 -to I2C_SCLK +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to I2C_SCLK +set_location_assignment PIN_F1 -to I2C_SDAT +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to I2C_SDAT + +#============================================================ +# 2x13 GPIO Header +#============================================================ +set_location_assignment PIN_A14 -to GPIO_2[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_2[0] +set_location_assignment PIN_B16 -to GPIO_2[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_2[1] +set_location_assignment PIN_C14 -to GPIO_2[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_2[2] +set_location_assignment PIN_C16 -to GPIO_2[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_2[3] +set_location_assignment PIN_C15 -to GPIO_2[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_2[4] +set_location_assignment PIN_D16 -to GPIO_2[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_2[5] +set_location_assignment PIN_D15 -to GPIO_2[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_2[6] +set_location_assignment PIN_D14 -to GPIO_2[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_2[7] +set_location_assignment PIN_F15 -to GPIO_2[8] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_2[8] +set_location_assignment PIN_F16 -to GPIO_2[9] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_2[9] +set_location_assignment PIN_F14 -to GPIO_2[10] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_2[10] +set_location_assignment PIN_G16 -to GPIO_2[11] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_2[11] +set_location_assignment PIN_G15 -to GPIO_2[12] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_2[12] +set_location_assignment PIN_E15 -to GPIO_2_IN[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_2_IN[0] +set_location_assignment PIN_E16 -to GPIO_2_IN[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_2_IN[1] +set_location_assignment PIN_M16 -to GPIO_2_IN[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_2_IN[2] + +# A few GPIOS on JP1 +set_location_assignment PIN_D3 -to GPIO_A[0] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_A[0] +set_location_assignment PIN_C3 -to GPIO_A[1] +set_location_assignment PIN_B8 -to GPIO_A_IN[1] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_A[1] +set_location_assignment PIN_A2 -to GPIO_A[2] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_A[2] +set_location_assignment PIN_A3 -to GPIO_A[3] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_A[3] +set_location_assignment PIN_B3 -to GPIO_A[4] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_A[4] +set_location_assignment PIN_B4 -to GPIO_A[5] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_A[5] +set_location_assignment PIN_A4 -to GPIO_A[6] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_A[6] +set_location_assignment PIN_B5 -to GPIO_A[7] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_A[7] +set_location_assignment PIN_A5 -to GPIO_A[8] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_A[8] +set_location_assignment PIN_D5 -to GPIO_A[9] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_A[9] +set_location_assignment PIN_B6 -to GPIO_A[10] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_A[10] +set_location_assignment PIN_A6 -to GPIO_A[11] +set_instance_assignment -name IO_STANDARD "3.3-V LVTTL" -to GPIO_A[11] + +#============================================================ +# End of pin assignments by Terasic System Builder +#============================================================ + + +set_global_assignment -name PARTITION_NETLIST_TYPE SOURCE -section_id Top +set_global_assignment -name PARTITION_FITTER_PRESERVATION_LEVEL PLACEMENT_AND_ROUTING -section_id Top +set_global_assignment -name PARTITION_COLOR 16764057 -section_id Top + +set_global_assignment -name TEXT_FILE fw.txt +set_global_assignment -name VERILOG_FILE ../verilog/regfile.v +set_global_assignment -name VERILOG_FILE ../verilog/library.v +set_global_assignment -name VERILOG_FILE ../verilog/cpu32.v +set_global_assignment -name VERILOG_FILE ../verilog/alu.v +set_global_assignment -name VERILOG_FILE ../verilog/uart.v +set_global_assignment -name VERILOG_FILE de0nano.v +set_global_assignment -name VERILOG_FILE aram.v +set_global_assignment -name SDC_FILE de0nano.sdc +set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top +\ No newline at end of file diff --git a/de0nano/de0nano.sdc b/de0nano/de0nano.sdc @@ -0,0 +1,85 @@ +#************************************************************** +# This .sdc file is created by Terasic Tool. +# Users are recommended to modify this file to match users logic. +#************************************************************** + +#************************************************************** +# Create Clock +#************************************************************** +create_clock -period 20 [get_ports CLOCK_50] + + +#************************************************************** +# Create Generated Clock +#************************************************************** +derive_pll_clocks + + + +#************************************************************** +# Set Clock Latency +#************************************************************** + + + +#************************************************************** +# Set Clock Uncertainty +#************************************************************** +derive_clock_uncertainty + + + +#************************************************************** +# Set Input Delay +#************************************************************** + + + +#************************************************************** +# Set Output Delay +#************************************************************** + + + +#************************************************************** +# Set Clock Groups +#************************************************************** + + + +#************************************************************** +# Set False Path +#************************************************************** + + + +#************************************************************** +# Set Multicycle Path +#************************************************************** + + + +#************************************************************** +# Set Maximum Delay +#************************************************************** + + + +#************************************************************** +# Set Minimum Delay +#************************************************************** + + + +#************************************************************** +# Set Input Transition +#************************************************************** + + + +#************************************************************** +# Set Load +#************************************************************** + + + diff --git a/de0nano/de0nano.v b/de0nano/de0nano.v @@ -0,0 +1,116 @@ +module de0nano( + input CLOCK_50, + output [7:0] LED, + input [1:0] KEY, + input [3:0] SW, + + output [12:0] DRAM_ADDR, + output [1:0] DRAM_BA, + output DRAM_CAS_N, + output DRAM_CKE, + output DRAM_CLK, + output DRAM_CS_N, + inout [15:0] DRAM_DQ, + output [1:0] DRAM_DQM, + output DRAM_RAS_N, + output DRAM_WE_N, + + output I2C_SCLK, + inout I2C_SDAT, + + inout [12:0] GPIO_2, + input [2:0] GPIO_2_IN, + + inout [11:0] GPIO_A +); + +wire clk, reset; +wire [31:0] romaddr, romdata, ramaddr, ramrdata, ramwdata; +wire [31:0] uartrdata; +wire cpurdata; +wire ramwe; +wire cs0,cs1; + +assign cs0 = (ramaddr[31:16] == 16'h0000); +assign cs1 = (ramaddr[31:16] == 16'hE000); + +reg [3:0] cntr; + +always @(posedge CLOCK_50) + cntr <= cntr + 1; + +//assign clk = CLOCK_50; +assign clk = cntr[3]; + +cpu32 cpu( + .clk(clk), + .i_addr(romaddr), + .i_data(romdata), + .d_data_r(cpurdata), + .d_data_w(ramwdata), + .d_addr(ramaddr), + .d_we(ramwe) + ); + +// ugly hack for now +mux2 #(32) rdatamux( + .sel(cs1), + .in0(ramrdata), + .in1({24'b0,uartrdata}), + .out(cpurdata) + ); + +rom rom( + .addr(romaddr[9:2]), + .data(romdata) + ); + +aram ram( + .clock(clk), + .address(ramaddr[10:2]), + .data(ramwdata), + .q(ramrdata), + .wren(cs0 & ramwe) +); + +assign GPIO_A[1] = bclk; +assign GPIO_A[3] = uartrdata[0]; + +uart uart0( + .clk(clk), + .bclk(bclk), + .reset(0), + .we(cs1 & ramwe), + .wdata(ramwdata), + .rdata(uartrdata[7:0]), + .tx(GPIO_A[7]) + ); + +reg [8:0] bcnt; +reg bclk; + +always @(posedge CLOCK_50) + if (bcnt == 217) begin + bcnt <= 0; + bclk = ~bclk; + end else begin + bcnt = bcnt + 1; + end + +reg [7:0] DBG; +assign LED = DBG; + +always @(posedge clk) + if (ramwe && (ramaddr == 32'hF0000000)) + DBG <= ramwdata[7:0]; + +endmodule + +module rom( + input [7:0] addr, + output [31:0] data + ); +reg [31:0] rom[0:2**7]; +initial $readmemh("fw.txt", rom); +assign data = rom[addr]; +endmodule diff --git a/de0nano/fw.s b/de0nano/fw.s @@ -0,0 +1,36 @@ + NOP + MOV R0, 0xAA + MOV R14, 0xF0000000 + SW R0, [R15] + B loop + +big: + MOV R9, 0xE0000000 + MOV R8, 0x34 + SW R8, [R9] + + ADD R0, R0, 1 + SW R0, [R1] + MOV R2, 5000000 +little: + SUB R2, R2, 1 + BNZ R2, little + B big + +loop: + MOV R0, 0x34 + BL dputc + MOV R0, 0x32 + BL dputc + MOV R0, 10 + BL dputc + B loop + +dputc: + MOV R1, 0xE0000000 +wait: + LW R2, [R1] + BNZ R2, wait + SW R0, [R1] + B R15 +