From 1eba55156d0c74752ccd3a8fd131a25ffa5a13b8 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sat, 25 Mar 2017 10:10:24 +0100 Subject: added missing makefile for z80 and fixed gitignore --- .gitignore | 54 +++++++++++++++++++++++++++--------------------------- sw/z80/makefile | 27 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 27 deletions(-) create mode 100644 sw/z80/makefile diff --git a/.gitignore b/.gitignore index f024179..e3afa4d 100644 --- a/.gitignore +++ b/.gitignore @@ -13,33 +13,33 @@ doc/**/*.log ## sw related # autotools -sw/**/makefile -sw/**/makefile.in -sw/**/ar-lib -sw/**/mdate-sh -sw/**/py-compile -sw/**/test-driver -sw/**/ylwrap -sw/**/autom4te.cache -sw/**/autoscan.log -sw/**/autoscan-*.log -sw/**/aclocal.m4 -sw/**/compile -sw/**/config.guess -sw/**/config.h.in -sw/**/config.log -sw/**/config.status -sw/**/config.sub -sw/**/configure -sw/**/configure.scan -sw/**/depcomp -sw/**/install-sh -sw/**/missing -sw/**/stamp-h* -sw/**/build-aux -sw/**/ltmain.sh -sw/**/texinfo.tex -sw/**/.deps +sw/linux/**/makefile +sw/linux/**/makefile.in +sw/linux/**/ar-lib +sw/linux/**/mdate-sh +sw/linux/**/py-compile +sw/linux/**/test-driver +sw/linux/**/ylwrap +sw/linux/**/autom4te.cache +sw/linux/**/autoscan.log +sw/linux/**/autoscan-*.log +sw/linux/**/aclocal.m4 +sw/linux/**/compile +sw/linux/**/config.guess +sw/linux/**/config.h.in +sw/linux/**/config.log +sw/linux/**/config.status +sw/linux/**/config.sub +sw/linux/**/configure +sw/linux/**/configure.scan +sw/linux/**/depcomp +sw/linux/**/install-sh +sw/linux/**/missing +sw/linux/**/stamp-h* +sw/linux/**/build-aux +sw/linux/**/ltmain.sh +sw/linux/**/texinfo.tex +sw/linux/**/.deps # binaries sw/**/*.hex diff --git a/sw/z80/makefile b/sw/z80/makefile new file mode 100644 index 0000000..94646a9 --- /dev/null +++ b/sw/z80/makefile @@ -0,0 +1,27 @@ +#### +# source code settings +# +OSNAME := helvetiOS + +CSOURCES := $(wildcard *.c) +BINARY := $(OSNAME).bin + +### +# compiler settings +# +CC := zcc +CARGS := -Wall -I . -DDEBUG -crt0 loader -asm z80asm -nostdlib + +all: $(BINARY) + +# build binary +$(BINARY): $(CSOURCES) + cp loader.asm loader.opt + $(CC) $(CARGS) $(CSOURCES) -o $@ + +dis: $(BINARY) + z80dasm -a -g 0h $< + +clean: + - rm $(BINARY) + - rm loader.opt -- cgit v1.2.1 From ea9fab15771cb152cd03de319eb2288441ca50c7 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sat, 25 Mar 2017 10:37:29 +0100 Subject: Git repository setup Git merge from master by atlas --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index f024179..f9378ca 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,10 @@ sw/**/*.hex sw/**/*.bin sw/**/*.o sw/**/*.a + +# custom +various/* + +# sublime +z80.sublime-project +z80.sublime-workspace -- cgit v1.2.1 From 985e16b181fd55e28538f2d4524550bd425b86e9 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Thu, 13 Apr 2017 16:03:11 +0200 Subject: switch from GAL (pld) to M4 32/32 CPLD add M4 32/32 CPLD datasheet new VHDL code with better control over the address space thanks to the M4 which has a 16 bit input port --- doc/datasheets/M4-32_32-15JC.pdf | Bin 0 -> 478635 bytes sw/cpld/ADDRESS_DECODER.STY | 4 + sw/cpld/ADDRESS_DECODER.lci | 107 +++++++++++ sw/cpld/ADDRESS_DECODER.lct | 107 +++++++++++ sw/cpld/ADDRESS_DECODER.naf | 22 +++ sw/cpld/ADDRESS_DECODER.syn | 11 ++ sw/cpld/ADDRESS_DECODER.tcl | 270 +++++++++++++++++++++++++++ sw/cpld/ADDRESS_DECODER_tcl.ini | 5 + sw/cpld/address_decoder.jhd | 3 + sw/cpld/address_decoder.jid | 1 + sw/cpld/address_decoder.rev | 3 + sw/cpld/address_decoder.vhd | 37 ++++ sw/cpld/automake.log | 10 + sw/cpld/syndos.env | 41 ++++ sw/pld/ADDRESS_DECODER.abs | Bin 1481 -> 0 bytes sw/pld/ADDRESS_DECODER.jed | 28 --- sw/pld/ADDRESS_DECODER.pdf | 169 ----------------- sw/pld/ADDRESS_DECODER.sim | 50 ----- sw/pld/__Previews/ADDRESS DECODER.PLDPreview | 14 -- sw/pld/address_decoder.PLD | 35 ---- 20 files changed, 621 insertions(+), 296 deletions(-) create mode 100644 doc/datasheets/M4-32_32-15JC.pdf create mode 100644 sw/cpld/ADDRESS_DECODER.STY create mode 100644 sw/cpld/ADDRESS_DECODER.lci create mode 100644 sw/cpld/ADDRESS_DECODER.lct create mode 100644 sw/cpld/ADDRESS_DECODER.naf create mode 100644 sw/cpld/ADDRESS_DECODER.syn create mode 100644 sw/cpld/ADDRESS_DECODER.tcl create mode 100644 sw/cpld/ADDRESS_DECODER_tcl.ini create mode 100644 sw/cpld/address_decoder.jhd create mode 100644 sw/cpld/address_decoder.jid create mode 100644 sw/cpld/address_decoder.rev create mode 100644 sw/cpld/address_decoder.vhd create mode 100644 sw/cpld/automake.log create mode 100644 sw/cpld/syndos.env delete mode 100644 sw/pld/ADDRESS_DECODER.abs delete mode 100644 sw/pld/ADDRESS_DECODER.jed delete mode 100644 sw/pld/ADDRESS_DECODER.pdf delete mode 100644 sw/pld/ADDRESS_DECODER.sim delete mode 100644 sw/pld/__Previews/ADDRESS DECODER.PLDPreview delete mode 100644 sw/pld/address_decoder.PLD diff --git a/doc/datasheets/M4-32_32-15JC.pdf b/doc/datasheets/M4-32_32-15JC.pdf new file mode 100644 index 0000000..7dcb44a Binary files /dev/null and b/doc/datasheets/M4-32_32-15JC.pdf differ diff --git a/sw/cpld/ADDRESS_DECODER.STY b/sw/cpld/ADDRESS_DECODER.STY new file mode 100644 index 0000000..afd24c5 --- /dev/null +++ b/sw/cpld/ADDRESS_DECODER.STY @@ -0,0 +1,4 @@ +[STRATEGY-LIST] +Normal=True, 1491209776 +[synthesis-type] +tool=Synplify diff --git a/sw/cpld/ADDRESS_DECODER.lci b/sw/cpld/ADDRESS_DECODER.lci new file mode 100644 index 0000000..47875d5 --- /dev/null +++ b/sw/cpld/ADDRESS_DECODER.lci @@ -0,0 +1,107 @@ + +[Device] +Family = M4A3; +PartNumber = M4A3-32/32-10JC; +Package = 44PLCC; +PartType = M4A3-32/32; +Speed = -10; +Operating_condition = COM; +Status = Production; + +[Revision] +Parent = m4a332.lci; +DATE = 2002; +TIME = 0:00:00; +Source_Format = Pure_VHDL; +Synthesis = Synplify; + +[Ignore Assignments] + +[Clear Assignments] + +[Backannotate Assignments] + +[Global Constraints] + +[Location Assignments] +layer = OFF; + +[Group Assignments] +layer = OFF; + +[Resource Reservations] +layer = OFF; + +[Fitter Report Format] + +[Power] + +[Source Constraint Option] + +[Fast Bypass] + +[OSM Bypass] + +[Input Registers] + +[Netlist/Delay Format] +NetList = VHDL; + +[IO Types] +layer = OFF; + +[Pullup] + +[Slewrate] + +[Region] + +[Timing Constraints] + +[HSI Attributes] + +[Input Delay] + +[opt global constraints list] + +[Explorer User Settings] + +[Pin attributes list] + +[global constraints list] + +[Global Constraints Process Update] + +[pin lock limitation] + +[LOCATION ASSIGNMENTS LIST] + +[RESOURCE RESERVATIONS LIST] + +[individual constraints list] + +[Attributes list setting] + +[Timing Analyzer] + +[PLL Assignments] + +[Dual Function Macrocell] + +[Explorer Results] + +[VHDL synplify constraints] + +[VHDL spectrum constraints] + +[verilog synplify constraints] + +[verilog spectrum constraints] + +[VHDL synplify constraints list] + +[VHDL spectrum constraints list] + +[verilog synplify constraints list] + +[verilog spectrum constraints list] diff --git a/sw/cpld/ADDRESS_DECODER.lct b/sw/cpld/ADDRESS_DECODER.lct new file mode 100644 index 0000000..47875d5 --- /dev/null +++ b/sw/cpld/ADDRESS_DECODER.lct @@ -0,0 +1,107 @@ + +[Device] +Family = M4A3; +PartNumber = M4A3-32/32-10JC; +Package = 44PLCC; +PartType = M4A3-32/32; +Speed = -10; +Operating_condition = COM; +Status = Production; + +[Revision] +Parent = m4a332.lci; +DATE = 2002; +TIME = 0:00:00; +Source_Format = Pure_VHDL; +Synthesis = Synplify; + +[Ignore Assignments] + +[Clear Assignments] + +[Backannotate Assignments] + +[Global Constraints] + +[Location Assignments] +layer = OFF; + +[Group Assignments] +layer = OFF; + +[Resource Reservations] +layer = OFF; + +[Fitter Report Format] + +[Power] + +[Source Constraint Option] + +[Fast Bypass] + +[OSM Bypass] + +[Input Registers] + +[Netlist/Delay Format] +NetList = VHDL; + +[IO Types] +layer = OFF; + +[Pullup] + +[Slewrate] + +[Region] + +[Timing Constraints] + +[HSI Attributes] + +[Input Delay] + +[opt global constraints list] + +[Explorer User Settings] + +[Pin attributes list] + +[global constraints list] + +[Global Constraints Process Update] + +[pin lock limitation] + +[LOCATION ASSIGNMENTS LIST] + +[RESOURCE RESERVATIONS LIST] + +[individual constraints list] + +[Attributes list setting] + +[Timing Analyzer] + +[PLL Assignments] + +[Dual Function Macrocell] + +[Explorer Results] + +[VHDL synplify constraints] + +[VHDL spectrum constraints] + +[verilog synplify constraints] + +[verilog spectrum constraints] + +[VHDL synplify constraints list] + +[VHDL spectrum constraints list] + +[verilog synplify constraints list] + +[verilog spectrum constraints list] diff --git a/sw/cpld/ADDRESS_DECODER.naf b/sw/cpld/ADDRESS_DECODER.naf new file mode 100644 index 0000000..fe52855 --- /dev/null +++ b/sw/cpld/ADDRESS_DECODER.naf @@ -0,0 +1,22 @@ +PA[15] i +PA[14] i +PA[13] i +PA[12] i +PA[11] i +PA[10] i +PA[9] i +PA[8] i +PA[7] i +PA[6] i +PA[5] i +PA[4] i +PA[3] i +PA[2] i +PA[1] i +PA[0] i +CSROMH o +CSROML o +CSRAM o +CSUART o +CSCTC o +CSPIO o diff --git a/sw/cpld/ADDRESS_DECODER.syn b/sw/cpld/ADDRESS_DECODER.syn new file mode 100644 index 0000000..419b6ba --- /dev/null +++ b/sw/cpld/ADDRESS_DECODER.syn @@ -0,0 +1,11 @@ +JDF B +// Created by Version 2.0 +PROJECT ADDRESS_DECODER +DESIGN address_decoder Normal +DEVKIT M4A3-32/32-10JC +ENTRY Pure VHDL +MODULE address_decoder.vhd +MODSTYLE ADDRESS_DECODER Normal +SYNTHESIS_TOOL Synplify +SIMULATOR_TOOL ActiveHDL +TOPMODULE ADDRESS_DECODER diff --git a/sw/cpld/ADDRESS_DECODER.tcl b/sw/cpld/ADDRESS_DECODER.tcl new file mode 100644 index 0000000..4c9fe3f --- /dev/null +++ b/sw/cpld/ADDRESS_DECODER.tcl @@ -0,0 +1,270 @@ + +########## Tcl recorder starts at 04/03/17 14:05:56 ########## + +set version "2.0" +set proj_dir "//nas001/account_PIF/_prossn/SAMB_3/lab3/projects/z80uPC/sw/cpld" +cd $proj_dir + +# Get directory paths +set pver $version +regsub -all {\.} $pver {_} pver +set lscfile "lsc_" +append lscfile $pver ".ini" +set lsvini_dir [lindex [array get env LSC_INI_PATH] 1] +set lsvini_path [file join $lsvini_dir $lscfile] +if {[catch {set fid [open $lsvini_path]} msg]} { + puts "File Open Error: $lsvini_path" + return false +} else {set data [read $fid]; close $fid } +foreach line [split $data '\n'] { + set lline [string tolower $line] + set lline [string trim $lline] + if {[string compare $lline "\[paths\]"] == 0} { set path 1; continue} + if {$path && [regexp {^\[} $lline]} {set path 0; break} + if {$path && [regexp {^bin} $lline]} {set cpld_bin $line; continue} + if {$path && [regexp {^fpgapath} $lline]} {set fpga_dir $line; continue} + if {$path && [regexp {^fpgabinpath} $lline]} {set fpga_bin $line}} + +set cpld_bin [string range $cpld_bin [expr [string first "=" $cpld_bin]+1] end] +regsub -all "\"" $cpld_bin "" cpld_bin +set cpld_bin [file join $cpld_bin] +set install_dir [string range $cpld_bin 0 [expr [string first "ispcpld" $cpld_bin]-2]] +regsub -all "\"" $install_dir "" install_dir +set install_dir [file join $install_dir] +set fpga_dir [string range $fpga_dir [expr [string first "=" $fpga_dir]+1] end] +regsub -all "\"" $fpga_dir "" fpga_dir +set fpga_dir [file join $fpga_dir] +set fpga_bin [string range $fpga_bin [expr [string first "=" $fpga_bin]+1] end] +regsub -all "\"" $fpga_bin "" fpga_bin +set fpga_bin [file join $fpga_bin] + +if {[string match "*$fpga_bin;*" $env(PATH)] == 0 } { + set env(PATH) "$fpga_bin;$env(PATH)" } + +if {[string match "*$cpld_bin;*" $env(PATH)] == 0 } { + set env(PATH) "$cpld_bin;$env(PATH)" } + +lappend auto_path [file join $install_dir "ispcpld" "tcltk" "lib" "ispwidget" "runproc"] +package require runcmd + +# Commands to make the Process: +# Hierarchy +if [runCmd "\"$cpld_bin/vhd2jhd\" address_decoder.vhd -o address_decoder.jhd -m \"$install_dir/ispcpld/generic/lib/vhd/location.map\" -p \"$install_dir/ispcpld/generic/lib\""] { + return +} else { + vwait done + if [checkResult $done] { + return + } +} + +########## Tcl recorder end at 04/03/17 14:05:56 ########### + + +########## Tcl recorder starts at 04/03/17 14:07:59 ########## + +# Commands to make the Process: +# Hierarchy +if [runCmd "\"$cpld_bin/vhd2jhd\" address_decoder.vhd -o address_decoder.jhd -m \"$install_dir/ispcpld/generic/lib/vhd/location.map\" -p \"$install_dir/ispcpld/generic/lib\""] { + return +} else { + vwait done + if [checkResult $done] { + return + } +} + +########## Tcl recorder end at 04/03/17 14:07:59 ########### + + +########## Tcl recorder starts at 04/03/17 14:08:48 ########## + +# Commands to make the Process: +# Hierarchy +if [runCmd "\"$cpld_bin/vhd2jhd\" address_decoder.vhd -o address_decoder.jhd -m \"$install_dir/ispcpld/generic/lib/vhd/location.map\" -p \"$install_dir/ispcpld/generic/lib\""] { + return +} else { + vwait done + if [checkResult $done] { + return + } +} + +########## Tcl recorder end at 04/03/17 14:08:48 ########### + + +########## Tcl recorder starts at 04/03/17 14:11:44 ########## + +# Commands to make the Process: +# Hierarchy +if [runCmd "\"$cpld_bin/vhd2jhd\" address_decoder.vhd -o address_decoder.jhd -m \"$install_dir/ispcpld/generic/lib/vhd/location.map\" -p \"$install_dir/ispcpld/generic/lib\""] { + return +} else { + vwait done + if [checkResult $done] { + return + } +} + +########## Tcl recorder end at 04/03/17 14:11:44 ########### + + +########## Tcl recorder starts at 04/03/17 14:22:22 ########## + +# Commands to make the Process: +# Hierarchy +if [runCmd "\"$cpld_bin/vhd2jhd\" address_decoder.vhd -o address_decoder.jhd -m \"$install_dir/ispcpld/generic/lib/vhd/location.map\" -p \"$install_dir/ispcpld/generic/lib\""] { + return +} else { + vwait done + if [checkResult $done] { + return + } +} + +########## Tcl recorder end at 04/03/17 14:22:22 ########### + + +########## Tcl recorder starts at 04/03/17 14:22:30 ########## + +# Commands to make the Process: +# Hierarchy +if [runCmd "\"$cpld_bin/vhd2jhd\" address_decoder.vhd -o address_decoder.jhd -m \"$install_dir/ispcpld/generic/lib/vhd/location.map\" -p \"$install_dir/ispcpld/generic/lib\""] { + return +} else { + vwait done + if [checkResult $done] { + return + } +} + +########## Tcl recorder end at 04/03/17 14:22:31 ########### + + +########## Tcl recorder starts at 04/03/17 14:28:11 ########## + +# Commands to make the Process: +# Hierarchy +if [runCmd "\"$cpld_bin/vhd2jhd\" address_decoder.vhd -o address_decoder.jhd -m \"$install_dir/ispcpld/generic/lib/vhd/location.map\" -p \"$install_dir/ispcpld/generic/lib\""] { + return +} else { + vwait done + if [checkResult $done] { + return + } +} + +########## Tcl recorder end at 04/03/17 14:28:11 ########### + + +########## Tcl recorder starts at 04/03/17 14:56:18 ########## + +# Commands to make the Process: +# Hierarchy +if [runCmd "\"$cpld_bin/vhd2jhd\" address_decoder.vhd -o address_decoder.jhd -m \"$install_dir/ispcpld/generic/lib/vhd/location.map\" -p \"$install_dir/ispcpld/generic/lib\""] { + return +} else { + vwait done + if [checkResult $done] { + return + } +} + +########## Tcl recorder end at 04/03/17 14:56:18 ########### + + +########## Tcl recorder starts at 04/03/17 14:56:23 ########## + +# Commands to make the Process: +# Hierarchy +if [runCmd "\"$cpld_bin/vhd2jhd\" address_decoder.vhd -o address_decoder.jhd -m \"$install_dir/ispcpld/generic/lib/vhd/location.map\" -p \"$install_dir/ispcpld/generic/lib\""] { + return +} else { + vwait done + if [checkResult $done] { + return + } +} + +########## Tcl recorder end at 04/03/17 14:56:23 ########### + + +########## Tcl recorder starts at 04/13/17 10:29:16 ########## + +# Commands to make the Process: +# Hierarchy +if [runCmd "\"$cpld_bin/vhd2jhd\" address_decoder.vhd -o address_decoder.jhd -m \"$install_dir/ispcpld/generic/lib/vhd/location.map\" -p \"$install_dir/ispcpld/generic/lib\""] { + return +} else { + vwait done + if [checkResult $done] { + return + } +} + +########## Tcl recorder end at 04/13/17 10:29:16 ########### + + +########## Tcl recorder starts at 04/13/17 10:29:50 ########## + +# Commands to make the Process: +# Hierarchy +if [runCmd "\"$cpld_bin/vhd2jhd\" address_decoder.vhd -o address_decoder.jhd -m \"$install_dir/ispcpld/generic/lib/vhd/location.map\" -p \"$install_dir/ispcpld/generic/lib\""] { + return +} else { + vwait done + if [checkResult $done] { + return + } +} + +########## Tcl recorder end at 04/13/17 10:29:50 ########### + + +########## Tcl recorder starts at 04/13/17 10:33:10 ########## + +# Commands to make the Process: +# Hierarchy +if [runCmd "\"$cpld_bin/vhd2jhd\" address_decoder.vhd -o address_decoder.jhd -m \"$install_dir/ispcpld/generic/lib/vhd/location.map\" -p \"$install_dir/ispcpld/generic/lib\""] { + return +} else { + vwait done + if [checkResult $done] { + return + } +} + +########## Tcl recorder end at 04/13/17 10:33:10 ########### + + +########## Tcl recorder starts at 04/13/17 10:33:11 ########## + +# Commands to make the Process: +# Hierarchy +if [runCmd "\"$cpld_bin/vhd2jhd\" address_decoder.vhd -o address_decoder.jhd -m \"$install_dir/ispcpld/generic/lib/vhd/location.map\" -p \"$install_dir/ispcpld/generic/lib\""] { + return +} else { + vwait done + if [checkResult $done] { + return + } +} + +########## Tcl recorder end at 04/13/17 10:33:11 ########### + + +########## Tcl recorder starts at 04/13/17 10:34:43 ########## + +# Commands to make the Process: +# Hierarchy +if [runCmd "\"$cpld_bin/vhd2jhd\" address_decoder.vhd -o address_decoder.jhd -m \"$install_dir/ispcpld/generic/lib/vhd/location.map\" -p \"$install_dir/ispcpld/generic/lib\""] { + return +} else { + vwait done + if [checkResult $done] { + return + } +} + +########## Tcl recorder end at 04/13/17 10:34:43 ########### + diff --git a/sw/cpld/ADDRESS_DECODER_tcl.ini b/sw/cpld/ADDRESS_DECODER_tcl.ini new file mode 100644 index 0000000..fae7b5f --- /dev/null +++ b/sw/cpld/ADDRESS_DECODER_tcl.ini @@ -0,0 +1,5 @@ +[Tcl] +Start = Yes; +Process = YES; +Append = YES; +TclFilename = ADDRESS_DECODER.tcl; diff --git a/sw/cpld/address_decoder.jhd b/sw/cpld/address_decoder.jhd new file mode 100644 index 0000000..19ef983 --- /dev/null +++ b/sw/cpld/address_decoder.jhd @@ -0,0 +1,3 @@ + + +MODULE ADDRESS_DECODER diff --git a/sw/cpld/address_decoder.jid b/sw/cpld/address_decoder.jid new file mode 100644 index 0000000..f0d5286 --- /dev/null +++ b/sw/cpld/address_decoder.jid @@ -0,0 +1 @@ +. ADDRESS_DECODER address_decoder.vhd \\nas001\account_pif\_prossn\samb_3\lab3\projects\z80upc\sw\cpld\address_decoder.vhd diff --git a/sw/cpld/address_decoder.rev b/sw/cpld/address_decoder.rev new file mode 100644 index 0000000..e8bfb3d --- /dev/null +++ b/sw/cpld/address_decoder.rev @@ -0,0 +1,3 @@ + + + diff --git a/sw/cpld/address_decoder.vhd b/sw/cpld/address_decoder.vhd new file mode 100644 index 0000000..2c80f86 --- /dev/null +++ b/sw/cpld/address_decoder.vhd @@ -0,0 +1,37 @@ +library ieee; +use ieee.std_logic_1164.all; +use ieee.std_logic_arith.all; +use ieee.std_logic_unsigned.all; + +entity ADDRESS_DECODER is + +port( + -- address input + PA: in unsigned(15 downto 0); + + -- chip selects output + -- memory + CSROMH: out std_logic; + CSROML: out std_logic; + CSRAM : out std_logic; + -- io chips + CSUART: out std_logic; + CSCTC : out std_logic; + CSPIO : out std_logic +); + +end; + +architecture Behavioral of ADDRESS_DECODER is +begin + -- memory + CSROMH <= 0 when ((PA >= x"0000") and (PA < x"2000")); + CSROML <= 0 when ((PA >= x"4000") and (PA < x"4000")); + CSRAM <= 0 when (PA >= x"D000"); + -- io chips + CSUART <= 0 when ((PA >= x"4000") and (PA < x"4008")); + -- CSCTC + -- CSPIO + +end Behavioral; + diff --git a/sw/cpld/automake.log b/sw/cpld/automake.log new file mode 100644 index 0000000..f24e14f --- /dev/null +++ b/sw/cpld/automake.log @@ -0,0 +1,10 @@ +ispLEVER Auto-Make Log File +--------------------------- + +Updating: Hierarchy +Start to record tcl script... +Finished recording TCL script. + +Starting: 'C:\ispLEVER_Classic2\ispcpld\bin\vhd2jhd.exe address_decoder.vhd -o address_decoder.jhd -m "C:\ispLEVER_Classic2\ispcpld/generic/lib/vhd/location.map" -p "C:\ispLEVER_Classic2\ispcpld/generic/lib"' + +Done: completed successfully. diff --git a/sw/cpld/syndos.env b/sw/cpld/syndos.env new file mode 100644 index 0000000..16036da --- /dev/null +++ b/sw/cpld/syndos.env @@ -0,0 +1,41 @@ +ABEL5DEV=C:\ispLEVER_Classic2\ispcpld\lib5 +DIOEDA_ABEL5DEV=C:\ispLEVER_Classic2\ispcpld\lib5 +DIOEDA_ActiveHDL=C:\ispLEVER_Classic2\active-hdl\BIN +DIOEDA_ActiveHDLPath=C:\ispLEVER_Classic2\active-hdl\BIN +DIOEDA_AppNotes=C:\ispLEVER_Classic2\ispcpld\bin +DIOEDA_Bin=C:\ispLEVER_Classic2\ispcpld\bin +DIOEDA_Config=C:\ispLEVER_Classic2\ispcpld\config +DIOEDA_CONTEXT=ispLEVER CLASSIC +DIOEDA_DSPPATH=C:\ispLEVER_Classic2\ispLeverDSP +DIOEDA_EPICPATH=C:\ispLEVER_Classic2\ispfpga\bin\nt +DIOEDA_Examples=C:\ispLEVER_Classic2\examples +DIOEDA_FPGABinPath=C:\ispLEVER_Classic2\ispfpga\bin\nt +DIOEDA_FPGAPath=C:\ispLEVER_Classic2\ispfpga +DIOEDA_HDLExplorer=C:\ispLEVER_Classic2\hdle\win32 +DIOEDA_INI=C:\lsc_env +DIOEDA_ispVM=C:\ispLEVER_Classic2\ispvmsystem +DIOEDA_ispVMSystem=C:\ispLEVER_Classic2\ispvmsystem +DIOEDA_License=C:\ispLEVER_Classic2\license +DIOEDA_LSEPath=C:\ispLEVER_Classic2\lse +DIOEDA_MachPath=C:\ispLEVER_Classic2\ispcpld\bin +DIOEDA_Manuals=C:\ispLEVER_Classic2\ispcpld\manuals +DIOEDA_ModelSim=C:\ispLEVER_Classic2\modelsim\win32loem +DIOEDA_ModelsimPath=C:\ispLEVER_Classic2\modelsim\win32loem +DIOEDA_PDSPath=C:\ispLEVER_Classic2\ispcomp +DIOEDA_Precision=C:\isptools\precision +DIOEDA_PrecisionPath=C:\isptools\precision +DIOEDA_ProductName=ispLEVER +DIOEDA_ProductPrefix=SYN +DIOEDA_ProductTitle=ispLEVER +DIOEDA_ProductType=2.0.00.17.20.15_LS_HDL_BASE_PC_N +DIOEDA_ProductVersion=2.0.00.17 +DIOEDA_ProgramFolder=ispLEVER Classic 2.0 +DIOEDA_Root=C:\ispLEVER_Classic2\ispcpld +DIOEDA_Spectrum=C:\isptools\spectrum +DIOEDA_SpectrumPath=C:\isptools\spectrum +DIOEDA_Synplify=C:\ispLEVER_Classic2\synpbase +DIOEDA_SynplifyPath=C:\ispLEVER_Classic2\synpbase +DIOEDA_Synthesis=C:\ispLEVER_Classic2\lse\bin\nt +DIOEDA_Tutorial=C:\ispLEVER_Classic2\ispcpld\tutorial +DIOPRODUCT=ispLEVER +PATH=C:\ispLEVER_Classic2\ispcpld\bin diff --git a/sw/pld/ADDRESS_DECODER.abs b/sw/pld/ADDRESS_DECODER.abs deleted file mode 100644 index ab6deb9..0000000 Binary files a/sw/pld/ADDRESS_DECODER.abs and /dev/null differ diff --git a/sw/pld/ADDRESS_DECODER.jed b/sw/pld/ADDRESS_DECODER.jed deleted file mode 100644 index 0525a9d..0000000 --- a/sw/pld/ADDRESS_DECODER.jed +++ /dev/null @@ -1,28 +0,0 @@ - -CUPL(WM) 5.0a Serial# 60008009 -Device g16v8as Library DLIB-h-40-2 -Created Fri Mar 17 15:18:30 2017 -Name ADDRESS_DECODER -Partno 00 -Revision 01 -Date 17.03.2017 -Designer Engineer -Company SAM Bellinzona -Assembly None -Location -*QP20 -*QF2194 -*G0 -*F0 -*L00512 01110111101110111011011110111011 -*L00768 10110111101110111011011110111011 -*L01024 10111011101110111011011110111011 -*L01280 11111111111111111111111111111011 -*L01536 11111111111111111111011110111011 -*L01792 11111111111111111111101110111011 -*L02048 00000100001100000011000000100000 -*L02112 00000000110000001111111111111111 -*L02144 11111111111111111111111111111111 -*L02176 111111111111111110 -*C1E45 -*A086 \ No newline at end of file diff --git a/sw/pld/ADDRESS_DECODER.pdf b/sw/pld/ADDRESS_DECODER.pdf deleted file mode 100644 index 2a0c7dc..0000000 --- a/sw/pld/ADDRESS_DECODER.pdf +++ /dev/null @@ -1,169 +0,0 @@ -{COMPONENT F:\SCHOOL\LAB3\PROJECTS\Z80UPC\SW\PLD\ADDRESS_DECODER.SYM - - {ENVIRONMENT - {PDIFvrev 3.00} - {Program "CUPL(WM) Version 5.0a"} - {DBtype "Schematic"} - {DBvrev 1.01} - {DBtime "Fri Mar 17 15:18:30 2017 "} - {DBunit "MIL"} - {DBgrid 10} - {Lyrstr "WIRES" 1 "BUS" 1 "GATE" 2 "IEEE" 2 "PINFUN" 3 "PINNUM" 1 - "PINNAM" 6 "PINCON" 4 "REFDES" 2 "ATTR" 6 "SDOT" 1 - "DEVICE" 5 "OUTLIN" 5 "ATTR2" 6 "NOTES" 6 "NETNAM" 4 - "CMPNAM" 5 "BORDER" 5} - } - - {USER - {VIEW - {Mode SYMB} - {Nlst OPEN} - {Vw 0 0 2} - {Lv 12 2 2 2 0 0 2 2 2 2 0 0 2 1 2 0 0 0 0} - {Gs 10 10} - } - } - - {DISPLAY - [Ly "PINNUM"] - [Ls "SOLID"][Wd 0] - [Ts 15][Tj "LC"][Tr 0][Tm "N"] - } - - {SYMBOL - {PIN_DEF - [Ly "PINCON"] - {P A8 {Pt "INPUT"}{Lq 0}{Ploc 100 160}} - {P A9 {Pt "INPUT"}{Lq 0}{Ploc 100 140}} - {P A10 {Pt "INPUT"}{Lq 0}{Ploc 100 120}} - {P A11 {Pt "INPUT"}{Lq 0}{Ploc 100 100}} - {P A12 {Pt "INPUT"}{Lq 0}{Ploc 100 80}} - {P A13 {Pt "INPUT"}{Lq 0}{Ploc 100 60}} - {P A14 {Pt "INPUT"}{Lq 0}{Ploc 100 40}} - {P A15 {Pt "INPUT"}{Lq 0}{Ploc 100 20}} - {P CSROML {Pt "I/O"}{Lq 0}{Ploc 290 20}} - {P CSROMH {Pt "I/O"}{Lq 0}{Ploc 290 40}} - {P CSRAM {Pt "I/O"}{Lq 0}{Ploc 290 60}} - {P CSUART {Pt "I/O"}{Lq 0}{Ploc 290 80}} - {P CSCTC {Pt "I/O"}{Lq 0}{Ploc 290 100}} - {P CSPIO {Pt "I/O"}{Lq 0}{Ploc 290 120}} - } - - {PKG - [Ly "REFDES"] - [Ts 25][Tj "CB"][Tr 0][Tm "N"] - {Rdl 195 190} - - [Ly "PINNUM"] - [Ts 15][Tj "RC"] - {Pnl 120 170} - {Pnl 120 150} - {Pnl 120 130} - {Pnl 120 110} - {Pnl 120 90} - {Pnl 120 70} - {Pnl 120 50} - {Pnl 120 30} - [Ts 15][Tj "LC"] - {Pnl 270 30} - {Pnl 270 50} - {Pnl 270 70} - {Pnl 270 90} - {Pnl 270 110} - {Pnl 270 130} - - {Sd A 2 3 4 5 6 7 8 9 12 13 14 15 16 17} - } - - {PIC - [Ly "GATE"] - [Ts 15][Tj "LC"][Tr 0][Tm "N"] - {R 130 180 260 0} - {L 130 160 100 160} - {L 130 140 100 140} - {L 130 120 100 120} - {L 130 100 100 100} - {L 130 80 100 80} - {L 130 60 100 60} - {L 130 40 100 40} - {L 130 20 100 20} - {L 260 20 290 20} - {L 260 40 290 40} - {L 260 60 290 60} - {L 260 80 290 80} - {L 260 100 290 100} - {L 260 120 290 120} - [Ly "PINNAM"] - [Tj "LC"] - {T "A8" 140 160} - {T "A9" 140 140} - {T "A10" 140 120} - {T "A11" 140 100} - {T "A12" 140 80} - {T "A13" 140 60} - {T "A14" 140 40} - {T "A15" 140 20} - [Tj "RC"] - {T "CSROML" 250 20} - {T "CSROMH" 250 40} - {T "CSRAM" 250 60} - {T "CSUART" 250 80} - {T "CSCTC" 250 100} - {T "CSPIO" 250 120} - [Ly "DEVICE"] - [Tj "CT"] - {T "G16V8AS" 195 -10} - } - - {ATR - {IN - {Org 100 20} - {Ty 255} - } - {EX - [Ly "ATTR2"] - [Ts 12][Tj "CT"][Tr 0][Tm "N"] - {At PLD F:\SCHOOL\LAB3\PROJECTS\Z80UPC\SW\PLD\ADDRESS_DECODER 195 180} - } - } - } - - {DETAIL - {ANNOTATE - } - - {NET_DEF - {N A8 - } - {N A9 - } - {N A10 - } - {N A11 - } - {N A12 - } - {N A13 - } - {N A14 - } - {N A15 - } - {N CSROML - } - {N CSROMH - } - {N CSRAM - } - {N CSUART - } - {N CSCTC - } - {N CSPIO - } - } - - {SUBCOMP - } - } -} diff --git a/sw/pld/ADDRESS_DECODER.sim b/sw/pld/ADDRESS_DECODER.sim deleted file mode 100644 index 05661c0..0000000 --- a/sw/pld/ADDRESS_DECODER.sim +++ /dev/null @@ -1,50 +0,0 @@ -%SIGNAL -PIN 2 = A8 -PIN 3 = A9 -PIN 4 = A10 -PIN 5 = A11 -PIN 6 = A12 -PIN 7 = A13 -PIN 8 = A14 -PIN 9 = A15 -PIN 16 = CSCTC -PIN 17 = CSPIO -PIN 14 = CSRAM -PIN 13 = CSROMH -PIN 12 = CSROML -PIN 15 = CSUART -%END - -%FIELD -%END - -%EQUATION -CSCTC => - !A8 & A9 & !A10 & !A11 & !A12 & A13 & !A14 & !A15 - -CSPIO => - A8 & A9 & !A10 & !A11 & !A12 & A13 & !A14 & !A15 - -CSRAM => - !A15 - -CSROMH => - A13 & !A14 & !A15 - -CSROML => - !A13 & !A14 & !A15 - -CSTIMER => - A15 - # A14 - # !A13 - # A12 - # A11 - # A10 - # A9 - # !A8 - -CSUART => - !A8 & !A9 & !A10 & !A11 & !A12 & A13 & !A14 & !A15 - -%END diff --git a/sw/pld/__Previews/ADDRESS DECODER.PLDPreview b/sw/pld/__Previews/ADDRESS DECODER.PLDPreview deleted file mode 100644 index 8b8cb8c..0000000 --- a/sw/pld/__Previews/ADDRESS DECODER.PLDPreview +++ /dev/null @@ -1,14 +0,0 @@ -[Preview] -LargeImageOriginalSize=708000 -LargeImageWidth=354 -LargeImageHeight=500 -LargeImage=78DAEDDDC16F1BD7B928F0F36FBC7D16D974D30B786543C8C2485104428287B65062040EE48230F2D80684A367C771D9BC3EDB819D101682A8A1AE60CB6050417608A444CC450495B980423DD45790B54841288B04E0CD26A0914DA145377C3C8722435196EBDC388D28FD163F703C9C9943CE913E8DCF7CF39D76BB1DDA0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000708015CBB5D06A747496F3F962473EACD7CA215F2885B56A292C74DE779E7E7C2F9F2F86ADE6DA8E757FEFA8BF7ED5F91961FA8FA8B2D90E53F9A9509EF97DD88CFFCE17D2FAF3D9B9305FFE289C9A38F9BD8E5F6BB4526C8FCAC5BC73FE03F8E4D27CE7B59596BFACD7C2DF1BFE76EE77B19FA2E1FEE3F0C6E176FB7EC89DCFED88C32F75E2F0E2CCE970365F1187F78146AB1DAAA5C203DFFBBAF3DEBD998B69F9F6D327C327D9937EAFF7B93B9DD83B3FF142EAA7C1FEE3F08E4BC418B9B156ED8F4BD4E3B84467B9D96C745E0BCED308F87AAD997EA7BF6A6E8576ABE19C8C80AF36D687FACF39010000607F5A5EDA7DEF2DE64B7C555D767E46796C42FFD1919B8D796BD594B796CD17C3C4D8D3296FEDD8F15C58A94E872347279DA77D205BAC8795D9DCEEBCA7C515F911A39CB7A6FFD8CE97D88AF912AF9CDE95B7F6D6E573E16C7E5EBEC43ECF97B85B6E846FD6CA6979FEE989F0D9A509E76C9FAB5E2A76FA6A6C57FF7178AF87F3F9A9F0E6D55CFF7A38E64B3C712413562BD7C2D1B18CF33402EECE2CA67C897BB796C39765F9A8FBDD17F57AA8DFBADDEFA76EFF392F00000000FCEB9FA753E767FF53E7E780E64BE83FB6F325E27DBAF83B3E9C2FB1DEDA0C479E3C265F621F88E731FE5DDC957FDADC0A9FCD5F728E46357F58FF216F4DDE1AF2D6D817E312EAFC8C3E757E46F05A589D1F00000046843A3F07746C42FFD156E76754A8F37340F3D6F41F6DF3D31D04E6A71B3DE6A763380E9B9F6EB4F3D6CC4F377ACC4F0700000000C85B93B7E63C206F4DDE1AF2D690B786BC35796BF25BE4ADC95B93B786BC357E2CEAAD1D0CEAAD8DE0D8B07A6B000000E6A71B11E6A73BA0F912FA8FB6F9E94685F9E90EE818B1FEA36D7EBA83902F617EBAD1637E3A869FE388D7C36F5ECDF59FE388F9124F1CC984D5CAB570742CE33C8D80BB338B295FE2DEADE5F065593EEA7EF745BD1EEAB76EF7FBA9DB7FCE0B000000FB933A3F07F43E9DFEA3ADCECFA850E7E780E6ADE93FDAEAFC1C04EAFC8C1E757E188EC3EAFC8C76DE9A3A3FA3479D1F869FA753E767F4A9F3338263C3EAFC000000A8F33322D4F939A0F912FA8FB63A3FA3429D9F033A46ACFF68ABF37310F225D4F9193DEAFC30FC1C873A3FA34F9D9FD1A2CE0F00000000FBC166CDB357F839841FDB61C99BF9746E393DF3FBD7CEEF7CF5E46B29FFF6DEF44CF73EC97233B49BDD1A847F5BEE3E637AB7B219DAF75743BDDCE8BF77F7E6CD5DC74DDB6F6D7CFBEF8DADFEB69F6D6E85BBE75E085FC5E756B79AA1B6B0E167EE90FF1CC2C3F29EBE6CED9DF7D4CFB3E9C4B1BD9607F7EF2DEFB5BED7C6E0F2038F3BB47E70FF47697BF03BDC8B71B5554FCB73AFBC9B5EFFF3E65C8AC79F6FB4C237CB73DDED3A71B496CF879BBF7E3DFC6363217CDE6CA7F7FEDE6AA5ED87CF4DDCFEE3C9F150CD4D857F34D7D2F6BD63FFC7E5EBE1F3CAADEEF7383F1D3E7B40EEDEEEEF31F6D0F3F6439DCFBDDA1EDC67AFF5719FBDD60FF6C75E6DCBDF826EDECC178DCD3DF39E7A79365FD7EA7B2F37BECD9BEA1D6BAFF5BD3606971F74DC5DEB078FF5086D0F3F7FF671EE6AB8D389B17F7EF95CE71AB516FE349EEBC4E0B5F0E164267C383E11FEFC8BB1F069B591E2F0B523E3E1D3CC78BA7EBE9BCB84A5E985CEF613E17676672C8DDBDF99180F1F4EE5C3374B0BE14EB11C3E2DE4C3ED895CD8BC7E39DCCE4CA7F8F2F1D51BA9EDC16BE75DE7B6F33D1EF69DBACB3FD0F9EC1CEB41EB07F7196E6FF0587BB6BD7DAC87FDBCF47EDE529D22BF8F0000000000000000000000000087D6F2526DD7BAF87CE057D565E76784E93FA2381F47AB514DF384F6E6E388F3841E3B9E0B2BD5E970E4E8A4F3B40F648BF5B0329BDBB5BEBEB812FEDEA83947234AFF11C5F9E9A6F253A13CF3FB5DF3D3CD973F0AA7264E7EAFE39B9FEE87F7C9A56FEB337C59AFF9BD1E01B19FA2E1FEE3F05E0F9B9F6EF4999F6EB4989F0E00000080FDA0588EF912B5942F91CF17D3FDB4982F912F94C25AB51416CAEEF9EC072F9F2F86ADE6DAAEBCB5FAEB579D9F51CE97D07F6CE74BC4FB74F1777C385F62BDB5198E3C794CBEC43E10CF63FCBBB82BFFB4B9655EB751CE1FD67F6CC7E1ADF6FD907BE5F4AE38FCD6E573E16C7E5E1CDE071AAD76A8960A0FCE951898D76DAFF905D95F06E70B342F1F715C22C6C88DB56A7F5C22E6ADC5E566B3D1792D384F23E0EB381F74BBD59DDFAD650EFA91B816DE581FEA3FE704000080FD499D9F033A36A1FF68ABF3332AD4F939A0796BFA8FB63A3F07813A3FA3479D1F86E3703BE6AD9DCFED88C32F75E2F0E2CCE970365F1187F779DEDAD79DF7EECD5C4CCBB79F3E193EC99EF47BBDCFDDE9C4DEF98917523F0DF61FF2D6E4ADC95B43DE1A000000C85B93B786BC35796BF2D690B786BC35E4ADC95B43DE9ABC35796BC85B43DE1AF2D6E4AD0100001CE47109F3D3ED7FE6A73BA0F912FA8FB6F9E94685F9E90EE818B1FEA36D7EBA83902F617EBAD1637E3A869FE388D7C36F5ECDF59FE388F9124F1CC984D5CAB570742CE33C8D80BB338B295FE2DEADE5F065593EEA7EF745BD1EEAB76EF7FBA9DB7FCE0B000000FB933A3F07F43E9DFEA3ADCECFA850E7E780E6ADE93FDAEAFC1C04EAFC8C1E757E188EC3EAFC8C76DE9A3A3FA3479D1F869FA753E767F4A9F3338263C3EAFC000000206F0D796BEC83FB74EAFCEC7FEAFC1CD038ACFF68ABF37310F225D4F9193DEAFC30FC1C873A3FA34F9D9FD1A2CE0F00000000FBE5793AF3D3ED7FE6A73B98F41FBD7C09757E469B3A3FA3479D1F86E3B03A3FA39DB7A6CECFE851E787E17109757E469F3A3F23F80C873A3F00000000C85B43DE9ABC350E7DBE847A6BFB9F7A6B07F45E9DFE43DE9ABC35E4AD216F0D796BF2D6E4AD010000B0AF999FEE808E4DE83FDADDF9385A8D6ACA5BEBCDC711F3D68E1DCF8595EA74387274D279DA07B2C57A5899CDEDCE7B5A5C51D76794F3D6F41F6DF5D60E02F5D6468F7A6B0C5F0F9B9F6EF4999F6EB4989F0E000000807D31AE583D3CCF5EC567CD6AF97CF86BC7A7A5527AEE2C8ED37DB1D64CEBBF59EBDE37B9575D0B5F948BE979D3B8FEB307DC5FAC154AE15EA1BBFED352356DF775AD9C96E3BE9F758EFB696121ADFFC7507D1ED428826187A9CEC8DF36B642BBB91CEE2E37C3679B5BE1EEB917BAEB3FBAF3EDDFA6F952A8971BFDEDE2EBAEE3C4F55B1BDFFEFBCE47DD7DB7B78FC7FD6A6535ADFBF8DC393F677BFC5D54E306B6E34E27E67CB3560E5F76AEFFE69F9E089F5D9AD8B54DF552B1F3DE58BA86DC6B7970FFDEF25EEB7B6D0C2E3FF0B843EB07F77F94B687BFC7E7CD76F866792EBDFEC7E5EBE1F3CAADB4FEF6AB17D3B56BACB772B7743DBDFF55DC6EA395B61F3ECEBD4E3CFF78723C547353E97AF73F6FCEF58F7FF7E63BE9B87F5B8AD7D9D907E6913DFC1C8E3DF4BCFD50E773AFB607F7D96B7DDC67AFF583FD31B87EF067CFEF2174F366BE686CEE99F7D4CBB3F9BA56DF7BB9F16DDE54EF587BADEFB531B8FCA0E3EE5A3F78AC47687BF87BDE2996C387E31361A9500C9BD72F87DB99E9F055270EFCE9D94C8AC39FE432E14FA7CF87BFD61AE1839399F0E164266DFFE75F8CED38CEA7D546B833311E3E9CEAC4EE77DF0D7FEA6C13C729E27E1F3E752C1DF7DEC26CF838970B1F8C67765C3B3FF47C76BEC7C3BE5377F9073A9F9D633D68FDE03EC3ED0D1E6BCFB6B78F35FC5D77E6DCF91D04000000000000000000000000F8AE1E34971BC07E15E7A1CBE6F3E1522E173293A7D2FC45D552216C75DEFB45EE72582FBD1B4AD5B5F0F4D84428E4B3E1EABF57427E6A324C4C64C3FAC65267FB6CDA67EB116A8AC539F072B96B69FB1B37AE85E7C673A1B6D60C998917C2F962314C8E4F84896C3ECDD134313E198A9D63579637D3F6B397BA73B32DD45B61FACC33697970FDA0BDE67203D88FE23C74F1F5C917FE1026C67E1226A7F2E1E2F34F856227DE6D562E860B7FE8D6C32AE42B9DD7CDF0F2F96268B7D643B5133F17FEB29EE2F04F8F8C87ADCDCA3F6D6B61632BDC5F9D0BF96239940AF9505A6F85F1C9A9D0AA17D3DC78AB7395D068B5534CAFCCADA6F62A4BCDD4C68DCBDDB87AE3C6628AC5B1BDC1F500A31C87E3756AFECC6BA158AEA56BCC56ABD1792D86A56A29BDD6D6373AD7A6F910EBB734B7E27568216DD74EDBE543AD5C7CA4B6EA9D18BB327B35C5DADE3E37AFFE36BDF6E2705C8E738B56AEDC4C7178A1B2996AE4BCF7C7426ABBBE70237DDECAF55BFDF5C3EDC4E3C76B7AFD0B8C827CA1D48DBDFF648EDF4AB9161EC7DC93718C23C6F4B58DE550AE35C25A27D6A7EBED52B51FDB639C2DE68B3BE27EA3564EFBC6399FBF9D03BABB5E3F020000C0685A6B6EA5FFE3C7FFEFF7C687E3D8401C638DCB710C218E1F74C701F2A1B9564D6308F13E5B73ABBB6F21EEB3D5ECEF5FABD7D37ED5B58D878E77D4B7EFC9E907E0305BBDDF4EF7C39E3A9D0F4BD772693CF6E299DF845772854E6CDD4C63B1E767DE4FF1F5CCC9B170BFB3CFDC956B697D8CA1BD3C8ACAE6567FFF5C67FFC21B17FBC77EE8DF81EDF16180C31E8763FCCC9CCAA5BCB5B5F7AF86E96AE71A389B0947C627FBD7C357CE3C1F66AB6B61FCF8CFD2F570BBBD154E8E4DECDAFFE28573E1D4FFFC6567F952DAE661EDCB6B000EBB781DDB6ED51F79FBDEF5F0E3CEA300000000781C7AE3C98FFA9C1DC06176ECE858A8369AE1899F1E0B13634753CD9FF8ECF14BD9B954BF213799096F4C57FBF57C8E1E3B12CE64DF0A936FE4C3F3CF8F87FCA55C3895990C9B9B6B9D7D0B9D633C9D7220AE2D35C395177FBA333E375A21D779BFB2B2112A85B3617A71291D7369713A9CB8F07E6854A7C373272E84FFFB7F2EF673E6863FAF1A3EC04113E3E5D844366C542E864CEE72CA77D8ACBC13AEC7FA3A5393E177A74F84A79E9BEAD7F3F9C5BFFD8FF087FC7CC82F7E10EEDC990BAD46399C2FADF76BF554F2DD5A6D17CE5E08574A3BEFFFC5F7E73BEF2F4EBF1B2A73A5F0F69BDDDA16736FBE1D0A95CDD05A2F85E23B0BE157A70AA9BD5F1E1FD747C08117E3E085E79F49390FBDE730E2B31ABDE738627E5A7FB9540CC5622154CB95502894C2EA7FC5673766FBB967BD381CEB40C4FDCAB5F5D0A8D576C4E1A7FFED99F49C488CC3BDE3C67FCFC5FA1285423A566FFD83728BD5F0010E9A58BFF2BFFB2C451C071ECC598BF52C1F5677A7B6DD56DCAF9B7FECFC03000000FF24A7E24826544BE7FFE91845BCDF579DCE1CD8F360DE3BE08770EAA56C7A3D71F5FD1D757ECE9ECFA61A3EF94A35FC3A3B17B69ACB292FE285677EB2A3E64F3BAE4F732B6D8633574AE16CE6C5547BED416DC563376A4BDDF9340AEF85E9857A3A56BD321BE64B736163AD11E6E2FC1BF757FBFBF4FE1DDBFEE8CE42981C1FEFDFC3EBCD9DD47FC67AAEB46B796EBEB463CEA56C3617D62B9570F3E695EEFB376FF6DB2875B649758A7217C3E5574FEC1EDF6EB4D425021EBB186F7B31B257A7A7F2EF57C353C78E875CF6B530FEE2ABE199CEF5F0E56B6F84539399502E57FA357FAA9DB874E9E2B970399709B3D59530F9F3639D78594F3534F76A2FF7FA4C3F4722B679A3B29C96DFEEC4E1DFFCFE7AF8FD6F0B3BE270CC678BF973D3E7B76BB965CF875CE73336572A7BC6E178BFB052C8A79A9E479F3ABA9D8B37D73F56E6F8CFC2CCFB4B29577AEDFD9994BB9CCD8CA71CBDB8FFA5D972589C3E2F5703F897C87462D054AC2D7CFA57FF92F6B2E767521C9D7BFDD7692CE3FA9967527C7DE6E727523CFEF9E4B5F43C476FFB182363ECBC94CD85E17A42B9F1C97E1CEEC5DEC1EB6EFD0B00000007CBC39E7503E0BBCB174A29AEC679E47A73D7C77B51F1D9E4E1E5380FDDDAE6665A7EE5972F865A6323ACD7CAE918C3FBC767A487EFD7C57C8358BBA7B9D54AE3B7F1DFBDBA6CBDE5B84F1C37AED7BBCF580FB63D988711732E7A9F3B8E07E7F385FEBFE358715A4EDB14D3729CC3A957076EF85E5B9C276F3697F1F300FC2862CE598C574F3EF5DB3031F6937E9C9A797FAD5F6F2DE52D6CCF4377F6D58BE97ED9334F67C3FD788F6C3B6F6D616363C7FED9B9D5B0B5B1B0A3AD5EFD89EB3762AEC3DB616671254C64F3E1FEEA5CB87973AE9B47B6DC0CAB1BCBE1E4D3274273ADBC9D07B1332FA27FCF6FE244FFF9E85EEED972B31D9ACBDD63C5CFD6AB99B15EB9D1BF96BF96DB7DCFAFD089DD7BE5DB01FC2BE270FECC6B0F9CAF39C6B9DE756C8C5DBDF99D4BA585505A28857275B95F67B8B77FABD548D7A131C72D1E6B300E0FD7F9E91DB7D75E3C569C33EFA3F9B9740D3CD8F6F0678FB968C57A2BC5FB5877A8582AA5FDFBDFA3B34DBC9E8EFB37D696FAD7CD954261D7F1E23EE68E067EEC7189876DF738E6A17BD43A3FF1FDC1CFB35C5DDBD5766F5CE261B9CA00000000003C7C7CB8371F46A158DC91D7D5BB7735983B56DAAE2F11B7E9DEF7FA36A7AC777FAC56AFA77B63D5B58D5DE3CEF158BDEDE37871DC7EB876BC3C32E030B932B71AA6AB8D90FD5FFF7B47DED97A2716DE78E777A178A9B0236F6D473E5B2796F6D65736B7FAF5DA72677E130A6F5C4C790FC3F96695C50FC246679B8D8585ED9CB4073F0F228F0C384C7138C6C5B9EC2BBBF2CE96AAA5F45A5BDFD8955FD6CD77D8DA915336783DDCDB77B8BDEB3333E97A7763A1FBECC65E71581E1970D8F2D606F37CBF4BDEDA77CD678B6311BDD81D73CF1E369F1D000000C04114C7B99D07603F38763C97E6073A9DC984ECC444AABB339D190B5BEDAD70E2F4EFC264261BDE98AEA61C895ECD86EF3B1E3D31FE5C7F5CB872FDD6B73912A56ABA37B7BCB915F253B970E372AE9F9F71757B3E8E58DFA2973337393ED6CFB1BB30BD98E6F968AD57FA6DF4C6A007DB187C2E7A6536E76700F8D175E7F88CF1B190EA458E4F4E85CD4A3ECD013A77E55A7AEFA9E7A6522CFCE991F1C7D2E6608EC4CD1B0B0F78BF5B5FEDBD42A51F9F67B6E7D11B14FF3E346AB3FD63C63A42CB85F9476A03603FC5E1786D983DF35ACA33EB3D63315B5D0BE3C77F96F2D3066BA17DDFF6624E5B2F46C6F99963DE71ABBE334E2E54363BD7C54BE1BD778B29BF225E231786EA02B5D26B2BBC7F6B71773EDC761B719BE61E6D44E6FC04000000000EB3F8FC70ACC53338975B774C786B477DF878AFACD8599F2F14532DF785F81CDD56F33B8F1B0FD6F989390FC3F3CE45EAFC0087496533C6DFA9B0B2BA12B2B96CCA5BEBE54B4CFDE695B44D2F7722D68378E5D997C37A6B331C79F258A8FCBFBFA4189ABBB614B6362B8FD6DE409D9F4A657347CD9F41EAFC0087290E6FB5EF87175F399DAE874F4C4E85D67A29BC5F6B849F1C3D169E7D2EB32377E27CF69DF0D6E573E16C7E3E34FF6B35E4A72643EE54E69163E6607E59CC4F1BCC351BBE4E57E707380C72B3B5743D3C7B75EF671A7AD7C371ECE2892399B05AB9168E8E65427365F63BB777716631E4B271BCA39C9EC9E82DEB0B0000008047B3BC54731E80C722D6F9B956590D13CF1EEBD7F9C94E8C85A3C78E8433D9B7C2E41BF9F0C69BB38FA5CECF6CAD112E9F9848CF2A67265E08576766D3F8F0851347C3D51BD574FC678E8E775ECF87F1679F0BE5623ECC2CAEA4F5B1767CABDDEAE7D62D576EA4D76BB96EFD9F5E1BF119ECF1E79E4DEF35EF37432E77B13F07DE7CB9D1FF1ED37F7C37BD2E2D4EEF687B75A59CF689ED95AA4BFDCF31FC5DB2C5BA3A41C063AB2FF1DAA54B612E7B7E479D9F532F65C31FF2F321BFF8C163ADF3F3FC994BA98D56BD18AEBEDDCD85AB14F26939DD37CC4C8758E327733A9FE2EBAF4E1552DBBF3C3E9E72323217A6D3DF8AFBAB732957E3F2AB2776B53157EAE65FBCF7C74298183B1A26A7F2A1723117DEBEB6908E117398DF7E752ADD779C7BF3ED1D6D2F3737D33EFDF6B63F879F15E087F252270E6F3457C2951887B7EBFCC4EBC862B110AAE54A28144A8FB5CE4FACE173F3EA6FD372CC9788D79A31972D2EC736E6A72E77AE97FF12164ADDF99A7A6DC767477ACF81C46BD5C6DA52677DA113C30BBBE2648CC331C6C6FCBB98FF36F8DC48DC67AE580C8DCD467F3EA8C1B6E3DF80B84F6C2F5EB7F73EC7F0BC51F173A913043C0E31F6C6D8D69BF7F3876CABF7CC5E2FA646F17A78708EBA627C7EE37B5C7FF6E2F67F670CE5FBB60D00000000000000000000000000000000C0E1F0FF01EB252590 -MediumImageOriginalSize=177000 -MediumImageWidth=177 -MediumImageHeight=250 -MediumImage=78DAEDDDDD531BD71DC6F1E7BFEBF4AE97BDE94567DA4E26E9749CE9244DDC348E3D71D27412E33489E3B738B63160306F12081092100810422C12922C10922A09C9321834A0E2A826840EDD5D4524344E9CA64E6CE4EFC56758EF6AD75AE9B0EC9EE7FC76F7F7F7B50F0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000038D2E22B5B4A44C6D5FA69A79CBD1E5DB972E591EBF8FD7EAD97F34FED3E856F17542D67ECE9D5A5BC3E5B2D34EDF7B75DA935F5FE7DDF36DCEF68B3DB7067D788AE5EB97AE4DB706D775F95B5E2C1BFEF2596552914B5B538DB54DF5DA5B0AA8CCB69EF1FC763E0E8CA94B754AB55E4E81B56607C46635EEF91DFA7FF3E97D8AB6D35F5B94433EFDFF711CA6EE9F295167DD8724917CE77EBE4EB6F36DDB9C4CAD49CEEC4E3AA18EEA6FAEEEEC49774BBE3BABD7F1C8F81A3ABBC6E9D4B6C99C7D66925E2096553A923BF4FE95C597B3BDBF6F466AED8D4DF9F752EF1ACB7E154655FC383ED0AFA83F20DCDEBD4DBEF3E729D13274E68D1F03FBDBF97D55D1592F5BFAF3B3B7B2A0503E6357C599F15924DD62F51D6AA316DEFDFB37E1C4EC40DFB381C8BC6944A355F3FCDE7DB3BE6CF5DEDEF36DF316BE7FEFD2FF78F738A66B2B9F9D5757AADB2D9D4FB5ADBE25CC2EA97F07B6ED9FD12D72EF7EAC4EBA78E7CBF44BA5C3DE85BABDEABAAB214D783EA56D3F54159FB74DFFC7DB5F68F9C8E9C8E9C0E00391D391D39DD0FEF5B6B6BFDC8EE5B1B1A9AD73B4DD0B7F6DFE712B9C0949D695562CDD50765ED53DAD96BEF1F7D6BF4ADD1B7464E474E474E474E474E474EF7C3AFE926026EFB9A6ED437A571AFAFF98E5577EEE941B5A207EBCD754C7E50AD6A239DB1F78FFE09723A723A723A723A723A723A723A723A80DA7C6AF3A9CDA79E8E7A3AEAE900D037C367F82CB2729EBC913CC8B11AF94FD2E9D2835ACD9EB69657B249659DDD87A61BF997F5DA4A3673683D6BF9D7A7ADF51A6316CAE179CDB4BA75C73074B7745F5FAC2695728F69D9E5B0E715E7C25F6589E6FC8DDB0B5A4B2634D739A8E2D8A8E2DD8E83E58FE37D5AAF6D4C37F6FFDBA6EBDBCD1C4C5BDB7DD6B3B2A721C7DA30BF9F468ED5C87FD63219FDB35CB1A7370AEBDA2AE4B4915C3C34DDC8BFECD7168A87D733977F7DDAFA3F3EDFAADAFFC746A6A8E5519F8A41B3BD9A6D76E9669B7293B34A76B4EBCE5C544BC37E95A6EA79B6357FD59835DBF2840ABE31DD35A2CA0466B4BF77DF5EFE38DEA7F5DE1AD3D66BED6D7DDBB4B9DDC636AC696BBB56A64D5B02000000403D1DF574D4D3514F473D1D00EAE9A8A7A39E8E7A3AEAE9A8A7A3369FDA7C504FC77823EAE9A8A7A39E8E7A3AEAE9A8A703C8E9C8E9C8E9C8E9C8E9C8E9E85BA36F8DBE35723A723A723A723A72BAA7FB9A8EFB5E1ED5FE61EE7B0990D391D391D391D391D391D301E474E474E47447FF7C98FB5E1EDD9C8EFB5E02E474E474E4748CF961CC0F637E18F3C3981FEAE980A39E71F04C99A37D3EFCAC3F53869C8E9C0E00391D391D391D7D6BF4AD713C06C879FE576BA9AC4AA1901E5456B51A4FE98BED2D958CB8D6D3797DF6E5F5E283ED1DDD2FE6550819DA48A5B45528A81098D5BFBFCCE09EB43D6B7C7293E78047C593783EDD46654FE585A8A2ADEDCACF46549A1A57D1FCB7F55C3AEB597507E7EBCE36DD8DCCE8DEEA8E927DD794F34F6BE3F6FC637F9F3FF4F9742B7349F3F76F9D76F414D49BFDD4CFA7AB94D7951EF2AA3031ADE2CC94F25EB78AF3112DF60FD8CFAA6B1CE752034EFD63C4A3BBF1A44A13663B9F0E687D61FEB1BFCF1FFA7CBAC6E7473B02000000F024441632F27ABD728F8C687DADA8D07450A3BE594D0767E41A18D0BC31A36CEA9BB5DF4B999266662665040D8D98EBF7F6BA34616EA39C5F5470C2AB7BD55D95B2717BBAB18EC7E3E333C76367DD9FEAC6C0985E7AE5B8AEB776E8C6C5BFCB3D30AE4466493DBDFD6A6F6F93BBAFFD1BEBCDCCCCA8B7DFA1EB7D6EAD55CB5A9E4D293812329755D473A345F1684CD168DC9E3EE8C32BD1978AC72F5F5C533A193D346F637DAB3E66FCBB328ACAB696131145A24915D72ACAA7932AE4CBF67AC9684489445CD164DA9EE673C68FDA37BCB3A7F0B45FD3E1A86AB59AA6FD7E85CD76998A1B9A9B3394CA1654CCA6ECE5C9584CA9E5C4E1738A25C6FDE1096774FFDA5768C9D0C5F3E7F5D1D9F3FAE4FA0DBDF3D1155DBB7E411FBCF7BEA2B98CEEDC5FB7971F7FF145F577741C5A7F3696E673C413B551DBD3FE6EF51BF3774D77574AF618B0479D570047665CAE798EB1B55EE6B3C053C5E90BE9F8E937F59BE78FA9E3930EBD76ECB73AF6CA49FDE2E73FD3CBA7CFE9B5DFFF4A9DB7DAF561CB790D8E8E6B7CB0DE47D1DED6AFFEAB57D5D1EDD0D9F31DEAFEE49C5E7EF5843CBDF5738DAFDF7B12F851C7406EEF283E39645FB36D6E56140AF8954CE71589CC6A2192D4D0C0883D9EDCED722BB610572C5ABFA6BBD533A87197CB7EEDDD5249C65CD09EDEAEAC3D741C3A00E0E196736BF27847E41CF2C8E31A90CB13D0F13FBEA2BEDE3E391C7D1A1F1D956BD8A7374F1E3F9C7184638ACCCDD8395D6757A722E6F1B95629D97D751EF790E2F1DB8A1861B99D034AA5330A8C79E5720ECB08871535E73B86BC1AF78D29323B29C330140A47D43B387630BE984C0FDFD7B06F5243C32EBB0D7BCD36DCE7F468D0E1D6E4645013DE2105C30B0ACD8635EC193F548F3FEC0BABF5E3165DEB1C54DFE0A0CE9C6D536D2D69B7E1D32FBDA0646A59B723730A8D8E285F5E572A1C9267D8AD8990A1E86C5081D9A8FCEE714542D3728E78955B5E946F224CA607E099CD9A03E6F131995C94110A2864C465C4926A39F586392FA1F472CA5E6EE5C78D63713299D666E59E9D27E70B053BEBCB16CA4AA5920AF8FDDADFDBB1FB98AD6DA7B245FBA77F3AAC74BE6C8F21B2FAE91AD77C647DF87FC7FC5CEA1DD30BCFFD4EBD9D4EFDE9855FEB569BCFFCBBEED5A937DED6952BEFEB6A87D35E7EFADD8F35D276B6DE27E79AD0F0B5AB3A77B55B416FBFDABAFAF5E9F5762DCD0CD8E70F8DEDDFB87849C3A3531A1CEA567F579B02937EDDF8F06FBADE3DACA9C1AE83AC6FAFB6C1F7819F74CC4FB1B0A244FCF0330BCBE57AFEB159D93CC8FAACE3339F33007CBB4038AD76F3EFFAAB2FBDA8881194A3AB5DDD3D7E390686F4B793AF289ACE289A30D4D3DDAD7367CE6878D0513F1F5ECA696E2A20EF6858B5AD7A6DBAC737659F07F3B9E2A76EC39E01879DD3A5CDF61A31220A8C4DAAB65BAB6776052B77ABD9CB7339F3FAEDCB7AF4C594D58627E41BF9EA5E92D6FDB8F79E92FB9700C051AAA773B9DD72385C5A5936D437302AFF6448F97CFE91D78286799C5EBD571FB759582928925856219751607458DB3B3BE6355E51418F53B9D23D2DC5E6E41AF29AD779BBDAB85BBFA74875779F7141782C7D6B43E3137AF9F516A596E6D4FAF1477AABE5BC3C23DFFD2CB7AD6A55A9F998CA9B35ED56EB6D3261CC6B2E34AFAE1B970FFA25FC63EE83F9217F40F7B76B8A466307DB615C108067DDD79F4F97CB65EDBE62ABC6733A386D3FABAEBCB6F6D071EF564DA855676765708DBE08F2363C09D63DB4DB7B6EE8B96327B4B830A6D75E3FADCBD73AF5C13B1775EAED77D57BF3A2861CBDDF5C6F21A1483866FF2C1931F2363C31D6B30C8281C3E7BE2B2B254D1ACB1AF7FAB4537D78ED51E18E759D16D6C2ED65EDD6B87729F030F57A54E0BBF5744FEAC45F4EEAB7E6B9C4ABCFFFD2AEA13BF6F27175F738BF73BD4F5B7B74FEC30FD476B34BEFBFF5865AFEFAB1DE3BF38E12D9B4FE7CEC0F1AF48EE9EA85333AFDA7DFDB632FACF678F1F225BDFFDEBBBA74E66DDDEA1ED4D9B3E7E4E8EE505B9743673FB8A0179E3FA673172E69BD9C3EE8D7A0EF0D8F1C033F6AE8665BAB02FE49E55632760D9D5517F7A8FAE5A9B9AC320B538AA7B25A8CC6D4D3DAADE54CC2BEDF4FDC08D9D77C997844462078D086AFDFEC5021973AB816CC6633F5D79BDB989FF46B361C35B7B162CFA3EF0D0000000000004F93FF001562BBBF -SmallImageOriginalSize=63600 -SmallImageWidth=106 -SmallImageHeight=150 -SmallImage=78DAEDDAFB5313571806E0F7AF6F3BADD5C1F1564A2BA6464D100D0430019298041340C34D72E592FB7D37F7DDDC88F4645110C199DA024BC7F78767D89D0D6CE68437DF77CE9EC3C3431C121111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111D1FFD6BBB5007C9E254C3C319FB956AAD4B1B5BE7AA9F78F2712E875FB686433A867D2BA8D43575151781FC4A0D7B9969F53329D41241446683BA8EBFBE8A92AD44A45B7FB1FF47AE8349AE27DB49927E68979629E98A76B205F28219D48229BCEEAFA3E06BD3E0EFA7D5DDFC3F0FE83DEC1B5FC9C7CCBCB587C358FB17BA3BAE6A9968CA3140EEB360E6AAD81F46A007DB5C93C314FAC4FECF7D8EF314FCC13F3C43C314FCC13F3C4F913E74F9C3F5DB26A3A8F5A2AA11D0FEBC3972AE99363796FFFE478377A749C3EFADDF4DB2D6456DFA01C0E213AF70AE5584CFCDD38E4780AF96014498F0BF1D76E7CE8B7CFBDCFB7DCEFF3D7CBFB09ADB67D0FCF0A9BA5B2F83910F5A126C85A9DF8A4593E396F14A4E363452A693F5BC5A3DFAD2533625CF7500A05910B6CA09A1463BEB7AB7D9F54445E25F19D5649A4D0575A1FEFF3E91EDF7EBFCF5F3F7470F081CF7C8988F327CE9F387F629E9827CE9FF83C97EB11CC13F3C4FAC47E8FFD1EF3C43C314FCC13F3C43C314FCC13E74F9C3F713D82EB11CC13EB13EB13FB3DF67BCC13F3C43C5DF0FEBD62248AB8FB3576DD7E144406877BF71A520B49BF1FB9801FB1B979742A25D473F9337BF0FEEDFEBDEF69EFDE85EDDFCB6421476328866390A2516DEFDEF0FBAC1C89400A8BF378029D6A05ED66F38B3D78FF6DFFDE75FDFF27A2EB2BB0B6891BBF8EC0F6CA0EB7D7078BC58A09E3F8F1F56CBE08BBDD81C579075645AD597EBB8ED0FB2D781D8BC7FD1AC7F1F2ED2752E828476B259DCED99EB4D15410DBD943269582542AA2509490CB0D7BC46D8EDF150A0623303E31C16A9DC15F46235E8B9ECDE3F563F4F747D858F11ECDA3AA0A5AD512C74B47B55AEDD4B9A228E7E68AF4E570FB307A67046693093FDD7A80877F8E61F6851953330E38E7A61089C6E171B8303D3585FBBF8D4311B9624DBA7AD95CEEF4FABE98F3745A0D4892AC9DCB9224C81C2B9D6D6D6FE3F9A40577EFDEC7CD1BB7306E3060E299199313A68FEB4A79B8161CB0CE5A11DFD981672580A74633D6963C08BFDF46606559AB6D1393D358B0DBE1723AB1E4B2B1A65DB092C84AB7A31E9FCBF2E9EC7444BEB2D92CEAD50A9496829CE8D30F077DD4EB754DB7DBE5385E01FFF23BFCF8C3CF5A7D72BAFD3018C661793185870FFF80DFE3C2C666080EBB1333D316989E3D85DFEB41AFDBC6A2A86BCE059BC8900D7333B39AE1DFCB2459BB2E432697C7A0DFFDEAFC69D8FFD56AF5A3DAA5AAC7F9C9E7F31CBF2BE4F6BDC3C8CD5BDA7A8477C98749B3E9D4FCA95C92B013DD4126BECF3E4FCFF588641ABDB67A2A4F9FE74A51DBC8899EB0A3B4385E3AAFEFDDBE3DA2AD43188C679FE9B69436D2224BC5A284D8EE3E567D01540A496CAC6F6033B0855828887259E65ADF15ADEF0DEBD0B9CFA6C4E754143D5E552EA358929113BDDFA0DF41269345219F835496108FC7399657B03F626C6C140B8B0B989A77C2629A80C3367B7C7D589F36039BC8A6D2CC8BCEFB23D48FEBE552B581BD68E474BF27EAD330378D2AD724F4E45A5AC19D1BBFE0C1DD7B303C7E76E6FAEE5E0A36FB3CA65F5AF078DC8097162B66AD7378613488EB07587AE3C573F373CCDA1CDAEB5E4E4EC3F0C888D4EE36D7242E902C57D156BEBE57B7D952B579ED70EE3474663FED17F3A8F35E434444F44FFC0D1F288E71 - diff --git a/sw/pld/address_decoder.PLD b/sw/pld/address_decoder.PLD deleted file mode 100644 index 1cc9e22..0000000 --- a/sw/pld/address_decoder.PLD +++ /dev/null @@ -1,35 +0,0 @@ -Name ADDRESS_DECODER ; -PartNo 00 ; -Date 17.03.2017 ; -Revision 01 ; -Designer Engineer ; -Company SAM Bellinzona ; -Assembly None ; -Location ; -Device g16v8a; - -/* *************** INPUT PINS *********************/ -PIN 2 = A8 ; -PIN 3 = A9 ; -PIN 4 = A10 ; -PIN 5 = A11 ; -PIN 6 = A12 ; -PIN 7 = A13 ; -PIN 8 = A14 ; -PIN 9 = A15 ; - -/* *************** OUTPUT PINS *********************/ -PIN 12 = CSROML ; -PIN 13 = CSROMH ; -PIN 14 = CSRAM ; -PIN 15 = CSUART ; -PIN 16 = CSCTC ; -PIN 17 = CSPIO ; - -CSRAM = !A15 ; -CSROML = !(!A15 & !A14 & !A13) ; -CSROMH = !(!A15 & !A14 & A13) ; -CSUART = !(!A15 & !A14 & A13 & !A12 & !A11 & !A10 & !A9 & !A8) ; -CSTIMER = !(!A15 & !A14 & A13 & !A12 & !A11 & !A10 & !A9 & A8) ; -CSCTC = !(!A15 & !A14 & A13 & !A12 & !A11 & !A10 & A9 & !A8) ; -CSPIO = !(!A15 & !A14 & A13 & !A12 & !A11 & !A10 & A9 & A8) ; -- cgit v1.2.1 From 1ec8f14f03322e3fe1f56f4abcbc85f5c2934dfc Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Tue, 2 May 2017 16:14:41 +0200 Subject: fix for sdcc makefile fix for the old makefile, because it could't compile more than one source file. new libc directory with mem.c to start implementing the standard C library (or at least the part we need). --- sw/z80/crt0.s | 125 +++++++++++++++++++++++++++++++++--------- sw/z80/kernel/include/types.h | 2 + sw/z80/libc/mem.c | 7 +++ sw/z80/makefile | 20 +++++-- 4 files changed, 122 insertions(+), 32 deletions(-) create mode 100644 sw/z80/libc/mem.c diff --git a/sw/z80/crt0.s b/sw/z80/crt0.s index d0ae3ca..7701ca6 100644 --- a/sw/z80/crt0.s +++ b/sw/z80/crt0.s @@ -1,30 +1,103 @@ - .area _HEADER (ABS) - ;; reset vector - .org 0 - jp init - - .org 0x08 - reti - .org 0x10 - reti - .org 0x18 - reti - .org 0x20 - reti - .org 0x28 - reti - .org 0x30 - reti - .org 0x38 - reti - - .org 0x100 +;-------------------------------------------------------------------------- +; crt0.s - Generic crt0.s for a Z80 +; +; Copyright (C) 2000, Michael Hope +; +; This library is free software; you can redistribute it and/or modify it +; under the terms of the GNU General Public License as published by the +; Free Software Foundation; either version 2, or (at your option) any +; later version. +; +; This library is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this library; see the file COPYING. If not, write to the +; Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, +; MA 02110-1301, USA. +; +; As a special exception, if you link this library with other files, +; some of which are compiled with SDCC, to produce an executable, +; this library does not by itself cause the resulting executable to +; be covered by the GNU General Public License. This exception does +; not however invalidate any other reasons why the executable file +; might be covered by the GNU General Public License. +;-------------------------------------------------------------------------- + .module crt0 + .globl _main + + .area _HEADER (ABS) + ;; Reset vector + .org 0 + jp init + + .org 0x08 + reti + .org 0x10 + reti + .org 0x18 + reti + .org 0x20 + reti + .org 0x28 + reti + .org 0x30 + reti + .org 0x38 + reti + + .org 0x100 init: - ;; set stack - ld sp,#0xFFFF + ;; Set stack pointer directly above top of memory. + ld sp,#0xFFFF + + ;; Initialise global variables + call gsinit + call _main + jp _exit + + ;; Ordering of segments for the linker. + .area _HOME + .area _CODE + .area _INITIALIZER + .area _GSINIT + .area _GSFINAL + + .area _DATA + .area _INITIALIZED + .area _BSEG + .area _BSS + .area _HEAP + + .area _CODE + +__clock:: + ld a,#2 + rst 0x08 + ret + +_exit:: + ;; Exit - special code to the emulator + ld a,#0 + rst 0x08 +1$: + halt + jr 1$ + + .area _GSINIT +gsinit:: + ; ld bc, #l__INITIALIZER + ld a, b + or a, c + jr Z, gsinit_next + ; ld de, #s__INITIALIZED + ; ld hl, #s__INITIALIZER + ldir +gsinit_next: - ;; call C main function - call _main + .area _GSFINAL + ret -.globl _main diff --git a/sw/z80/kernel/include/types.h b/sw/z80/kernel/include/types.h index adde214..c24b311 100644 --- a/sw/z80/kernel/include/types.h +++ b/sw/z80/kernel/include/types.h @@ -6,4 +6,6 @@ #define int16_t int #define uint16_t unsigned int +#define size_t uint16_t + #endif diff --git a/sw/z80/libc/mem.c b/sw/z80/libc/mem.c new file mode 100644 index 0000000..667a752 --- /dev/null +++ b/sw/z80/libc/mem.c @@ -0,0 +1,7 @@ +#include "types.h" +#include "mem.h" + +void *malloc(size_t size) +{ + : +} diff --git a/sw/z80/makefile b/sw/z80/makefile index ecdd9a4..3d682ca 100644 --- a/sw/z80/makefile +++ b/sw/z80/makefile @@ -4,6 +4,7 @@ OSNAME := helvetiOS CSOURCES := $(wildcard kernel/*.c) $(wildcard libc/*.c) +OBJECTS := $(patsubst %.c,build/%.rel,$(CSOURCES)) HEXFILE := build/$(OSNAME).hex BINARY := build/$(OSNAME).bin @@ -12,26 +13,33 @@ BINARY := build/$(OSNAME).bin CC := sdcc -CFLAGS := -mz80 --no-std-crt0 crt0.rel \ +CFLAGS := -mz80 \ -I kernel/include -I libc/include -DDEBUG -LDFLAGS := --code-loc 0x0800 --data-loc 0x8000 +LDFLAGS := -mz80 --no-std-crt0 crt0.rel \ + --code-loc 0x0800 --data-loc 0x8000 +.PHONY: dirs dis clean all: $(BINARY) # build binary -$(BINARY): $(CSOURCES) crt0.rel - mkdir -p build - $(CC) $(CFLAGS) $(LDFLSGS) $(CSOURCES) -o $(HEXFILE) +$(BINARY): $(OBJECTS) dirs + $(CC) $(LDFLAGS) $(OBJECTS) -o $(HEXFILE) xxd -r -p $(HEXFILE) $(BINARY) +$(OBJECTS): build/%.rel : %.c $(CSOURCES) dirs crt0.rel + $(CC) $(CFLAGS) -c $< -o $@ + crt0.rel: crt0.s sdasz80 -o $< +dirs: + mkdir -p build build/kernel build/libc + dis: $(BINARY) z80dasm -a -g 0h $< -o $(OSNAME).s clean: - - rm build/* + - rm -rd build/* - rm $(OSNAME).s - rm crt0.rel -- cgit v1.2.1 From 0b5b2c24c52281db0437320a22bced87043d4dfb Mon Sep 17 00:00:00 2001 From: "leleraffa97@hotmail.it" Date: Tue, 2 May 2017 17:12:23 +0200 Subject: Basic sys io setup --- sw/z80/sysio.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 sw/z80/sysio.h diff --git a/sw/z80/sysio.h b/sw/z80/sysio.h new file mode 100644 index 0000000..5d1f5ae --- /dev/null +++ b/sw/z80/sysio.h @@ -0,0 +1,55 @@ +#ifndef __SYSIO_H__ +#define __SYSIO_H__ + +#include "types.h" + +/* +* Memory management +*/ + +void * malloc(uint16_t size); +uint16_t malloc_size(void * address); +void free(void * address); + +/* +* File management +*/ + +#define F_WRITE "w" +#define F_READ "r" +#define F_BIN_WRITE "wb" +#define F_BIN_READ "rb" + +#define F_READ_CODE 0x0 +#define F_WRITE_CODE 0x1 +#define F_BIN_READ_CODE 0x2 +#define F_BIN_WRITE_CODE 0x3 + +#define F_PERM_READ 0x0 +#define F_PERM_WRITE 0x1 +#define F_PERM_RW 0x2 + +struct file { + + const char * path; + unsigned int mode:4; + unsigned int permission:4; +}; + +#define FILE struct file + +FILE * fopen(const char * path, const char * mode); +uint8_t fclose(FILE * file); + +// TODO: other functions + +/* +* Processes management +*/ + +#define PID uint16_t + +void exit(); // exit this program +void interrupt(PID) + +#endif \ No newline at end of file -- cgit v1.2.1 From 100226618493b6a3c7da96048734d50f5011a01f Mon Sep 17 00:00:00 2001 From: "leleraffa97@hotmail.it" Date: Tue, 2 May 2017 18:11:33 +0200 Subject: sysio.h libc interface --- sw/z80/libc/include/sysio.h | 55 +++++++++++++++++++++++++++++++++++++++++++++ sw/z80/sysio.h | 55 --------------------------------------------- 2 files changed, 55 insertions(+), 55 deletions(-) create mode 100644 sw/z80/libc/include/sysio.h delete mode 100644 sw/z80/sysio.h diff --git a/sw/z80/libc/include/sysio.h b/sw/z80/libc/include/sysio.h new file mode 100644 index 0000000..5d1f5ae --- /dev/null +++ b/sw/z80/libc/include/sysio.h @@ -0,0 +1,55 @@ +#ifndef __SYSIO_H__ +#define __SYSIO_H__ + +#include "types.h" + +/* +* Memory management +*/ + +void * malloc(uint16_t size); +uint16_t malloc_size(void * address); +void free(void * address); + +/* +* File management +*/ + +#define F_WRITE "w" +#define F_READ "r" +#define F_BIN_WRITE "wb" +#define F_BIN_READ "rb" + +#define F_READ_CODE 0x0 +#define F_WRITE_CODE 0x1 +#define F_BIN_READ_CODE 0x2 +#define F_BIN_WRITE_CODE 0x3 + +#define F_PERM_READ 0x0 +#define F_PERM_WRITE 0x1 +#define F_PERM_RW 0x2 + +struct file { + + const char * path; + unsigned int mode:4; + unsigned int permission:4; +}; + +#define FILE struct file + +FILE * fopen(const char * path, const char * mode); +uint8_t fclose(FILE * file); + +// TODO: other functions + +/* +* Processes management +*/ + +#define PID uint16_t + +void exit(); // exit this program +void interrupt(PID) + +#endif \ No newline at end of file diff --git a/sw/z80/sysio.h b/sw/z80/sysio.h deleted file mode 100644 index 5d1f5ae..0000000 --- a/sw/z80/sysio.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __SYSIO_H__ -#define __SYSIO_H__ - -#include "types.h" - -/* -* Memory management -*/ - -void * malloc(uint16_t size); -uint16_t malloc_size(void * address); -void free(void * address); - -/* -* File management -*/ - -#define F_WRITE "w" -#define F_READ "r" -#define F_BIN_WRITE "wb" -#define F_BIN_READ "rb" - -#define F_READ_CODE 0x0 -#define F_WRITE_CODE 0x1 -#define F_BIN_READ_CODE 0x2 -#define F_BIN_WRITE_CODE 0x3 - -#define F_PERM_READ 0x0 -#define F_PERM_WRITE 0x1 -#define F_PERM_RW 0x2 - -struct file { - - const char * path; - unsigned int mode:4; - unsigned int permission:4; -}; - -#define FILE struct file - -FILE * fopen(const char * path, const char * mode); -uint8_t fclose(FILE * file); - -// TODO: other functions - -/* -* Processes management -*/ - -#define PID uint16_t - -void exit(); // exit this program -void interrupt(PID) - -#endif \ No newline at end of file -- cgit v1.2.1 From 8a461a14c3ceaf42f1483abe51cda47ac785bfc9 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Tue, 2 May 2017 22:09:40 +0200 Subject: add serial device struct other changes: - change from main() to kmain() in crt0.s and kernel.c - new file devices.h to define all address locations for devices - new data type - register_t as volatile uint8_t for registers in devices - size_t from libc --- sw/z80/crt0.s | 4 +- sw/z80/kernel/include/devices.h | 13 +++++++ sw/z80/kernel/include/serial.h | 85 +++++++++++++++++++++++++++++++++++++++++ sw/z80/kernel/include/types.h | 2 + sw/z80/kernel/kernel.c | 7 +--- sw/z80/libc/mem.c | 7 ---- 6 files changed, 104 insertions(+), 14 deletions(-) create mode 100644 sw/z80/kernel/include/devices.h create mode 100644 sw/z80/kernel/include/serial.h delete mode 100644 sw/z80/libc/mem.c diff --git a/sw/z80/crt0.s b/sw/z80/crt0.s index 7701ca6..00c7da1 100644 --- a/sw/z80/crt0.s +++ b/sw/z80/crt0.s @@ -27,7 +27,7 @@ ;-------------------------------------------------------------------------- .module crt0 - .globl _main + .globl _kmain .area _HEADER (ABS) ;; Reset vector @@ -56,7 +56,7 @@ init: ;; Initialise global variables call gsinit - call _main + call _kmain jp _exit ;; Ordering of segments for the linker. diff --git a/sw/z80/kernel/include/devices.h b/sw/z80/kernel/include/devices.h new file mode 100644 index 0000000..ea29065 --- /dev/null +++ b/sw/z80/kernel/include/devices.h @@ -0,0 +1,13 @@ +#ifndef __DEVICES_H__ +#define __DEVICES_H__ + +#define ADDR_DEV_ROM_L 0x0000 +#define ADDR_DEV_ROM_H 0x2000 + +#define ADDR_DEV_USART 0x4000 +#define ADDR_DEV_CTC +#define ADDR_DEV_PIO + +#define ADDR_DEV_RAM 0x8000 + +#endif diff --git a/sw/z80/kernel/include/serial.h b/sw/z80/kernel/include/serial.h new file mode 100644 index 0000000..03e2448 --- /dev/null +++ b/sw/z80/kernel/include/serial.h @@ -0,0 +1,85 @@ +#ifndef __SERIAL_H__ +#define __SERIAL_H__ + +#include "types.h" +#include "devices.h" + +/* this structure is only for internal usage */ +struct _usart_device +{ + register_t buffer; // also used as LSB for divisor latch + + struct IER + { + volatile int received_data_interrupt :1; + volatile int transmitter_empty_interrupt :1; + volatile int receiver_line_status_interrupt :1; + volatile int modem_status_interrupt :1; + volatile int reserved :4; + } IER; + + struct IIR + { + volatile int interrupt_pending :1; + volatile int interrupt_id :3; + volatile int reserved :2; + volatile int fifos :2; + } IIR; + + struct FCR + { + volatile int fifo_enable :1; + volatile int receiver_fifo_rst :1; + } + + struct LCR + { + volatile int word_length :2; + volatile int stop_bits :1; + volatile int parity :1; + volatile int even_parity :1; + volatile int stick_parity :1; + volatile int break_control :1; + volatile int divisor_latch_access :1; + } LCR; + + struct MCR + { + volatile int data_terminal_ready :1; + volatile int request_to_send :1; + volatile int out1; + volatile int out2; + volatile int loop; + volatile int autoflow :1; + volatile int reserved :2; + } MCR; + + struct LSR + { + volatile int data_ready :1; + volatile int overrun_error :1; + volatile int parity_error :1; + volatile int framing_error :1; + volatile int break_interrupt :1; + volatile int transmitter_register :1; + volatile int transmitter_emtpy :1; + volatile int fifo_recv_error :1; + } LSR; + + struct MSR + { + volatile int delta_cts :1; + volatile int delta_data_set_ready :1; + volatile int trailing_edge_ring_indicator :1; + volatile int delta_data_carrier_detect :1; + volatile int clear_to_send :1; + volatile int data_set_ready :1; + volatile int ring_indicator :1; + volatile int data_carrier_detect :1; + } MSR; + + register_t scratch; +} *_usart = (_usart_device *) ADDR_DEV_USART; + + +#endif // __SERIAL__H__ diff --git a/sw/z80/kernel/include/types.h b/sw/z80/kernel/include/types.h index c24b311..552b7e9 100644 --- a/sw/z80/kernel/include/types.h +++ b/sw/z80/kernel/include/types.h @@ -1,6 +1,8 @@ #ifndef __TYPES_H__ #define __TYPES_H__ +#define register_t volatile unsigned char + #define int8_t char #define uint8_t unsigned char #define int16_t int diff --git a/sw/z80/kernel/kernel.c b/sw/z80/kernel/kernel.c index fe87c3d..3db6579 100644 --- a/sw/z80/kernel/kernel.c +++ b/sw/z80/kernel/kernel.c @@ -1,10 +1,7 @@ #include "types.h" -void main(void) +void kmain(void) { - int i, j = 20; - for (i = 0; i < 10; i++) { - j--; - } + } diff --git a/sw/z80/libc/mem.c b/sw/z80/libc/mem.c deleted file mode 100644 index 667a752..0000000 --- a/sw/z80/libc/mem.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "types.h" -#include "mem.h" - -void *malloc(size_t size) -{ - : -} -- cgit v1.2.1 From 616143a55b8802714a457086beaa2788d1d48058 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Wed, 3 May 2017 22:36:18 +0200 Subject: new file coding_rules.txt to have a consistent coding style --- sw/z80/coding_rules.txt | 120 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 sw/z80/coding_rules.txt diff --git a/sw/z80/coding_rules.txt b/sw/z80/coding_rules.txt new file mode 100644 index 0000000..e5c11f0 --- /dev/null +++ b/sw/z80/coding_rules.txt @@ -0,0 +1,120 @@ +CODING STYLE FOR THIS PROJECT +============================= + +In order to have a consistent codebase, there are the following rules on +writing code in C (and assembly). For the most part they are similar to the +Linux kernel coding rules by Torvalds. + +PROGRAM LOGIC +------------- +I expect a certain level of common sense from people so I won't mention the +super-basic stuff. But I would like to point out a few thing I WON'T accept +(unless there is a valid reason and an explanation of why). First, I believe +that code has to be aesthetically pleasing to watch and with a clear logic +flow so: + + - Avoid deeply nested code and recursive black magic + + - No special cases: generally the code of a function should behave the + same with any argument. Avoid horrible exceptions for magic values + + - No extreme modularization: do not write code that is extremely + encapsulated with dozens of helper functions to control every signal + that runs through the damn motherboard + +EDITOR (SPACES > TABS) +---------------------- +You can use your favourite editor but spaces are better than tabs, no +discussion. For this project every source file must have an indent of 4 +spaces. Since 80 characters is the standard terminal width, the code has to be +hard wrapped at 80, 78 or 72 characters. Also there shouldn't be any markup on +the source code for your editor, not even in the comments; just the code. + + - use spaces, 1 indent - 4 spaces + - hard wrap at 80 / 78 / 72 characters + - no markup for folds or any other editor specific feature + + +C CODE INDENT AND BRACES +------------------------ +I personally prefer the K&R coding style because it was used in 'The C +Programming Language' book from Dennis Ritchie which is the 'standard' for +learning C. But I also like Linus' kernel coding rules, so sometimes I might +use some of his rules. Anyway, you can look them up if you want to or just +look at the following example that sums most of the important stuff. + + - K&R braces and function prototypes + - snake_case for variables and function names + - pointer asterisk in front of the variable ( ex: int *p; ) + +Here's a short example that uses most of the stuff: + + #include + #include + + #define MY_DEVICE_MEMORY_ADDR 0x5020 + + #define MY_DEVICE_FLAG_RDY 1 + #define MY_DEVICE_FLAG_ERR 2 + + // same for unions + struct my_device + { + volatile uint8_t buffer; + volatile uint8_t flags; + } *_my_dev = (struct my_device *) MY_DEVICE_MEMORY_ADDR; + + + int my_device_write(uint8_t *data, size_t size); + + /* This is the main function + * and this is a multiline comment to explain something if needed + */ + int main(int argc, char *argv[]) + { + int i; + int j = 0; + uint8_t data[2] = { 0xFF, 0xAB }; + const char *string = "My magic string"; + + while (j < 100) { + j++; + } + + printf("%s\n", string); + + if (some_condition) { + // inline comment + } else { + my_device_write(data, 2); + } + + switch (i) { + case 0: + some_function(); + break; + + case 1: + // ... + break; + + default: + // ... + } + } + + int my_device_write(uint8_t *data, size_t size) + { + int i; + + for (i = 0; i < size; i++) { + _my_dev.buffer = data; + while (!(_my_dev.flags & (1< Date: Fri, 2 Jun 2017 16:22:26 +0200 Subject: add serial interface and a few std library functions changes in usart: - new functions to setup the serial comunication settings such as baudrate, parity and stop bits - init function with most common values - transmit and receive functions each with a wrapper to send data blocks changes in libc: - new file stdio.c with basic implementation of putch, printf still a prototype - new file string.c with memcpy() function --- sw/z80/kernel/include/devices.h | 6 +- sw/z80/kernel/include/pio.h | 18 +++++ sw/z80/kernel/include/serial.h | 85 ----------------------- sw/z80/kernel/include/usart.h | 149 ++++++++++++++++++++++++++++++++++++++++ sw/z80/kernel/kernel.c | 4 +- sw/z80/kernel/pio.c | 29 ++++++++ sw/z80/kernel/usart.c | 91 ++++++++++++++++++++++++ sw/z80/libc/include/stdio.h | 11 +++ sw/z80/libc/include/string.h | 8 +++ sw/z80/libc/stdio.c | 12 ++++ sw/z80/libc/string.c | 13 ++++ 11 files changed, 336 insertions(+), 90 deletions(-) create mode 100644 sw/z80/kernel/include/pio.h delete mode 100644 sw/z80/kernel/include/serial.h create mode 100644 sw/z80/kernel/include/usart.h create mode 100644 sw/z80/kernel/pio.c create mode 100644 sw/z80/kernel/usart.c create mode 100644 sw/z80/libc/include/stdio.h create mode 100644 sw/z80/libc/include/string.h create mode 100644 sw/z80/libc/stdio.c create mode 100644 sw/z80/libc/string.c diff --git a/sw/z80/kernel/include/devices.h b/sw/z80/kernel/include/devices.h index ea29065..e8c183f 100644 --- a/sw/z80/kernel/include/devices.h +++ b/sw/z80/kernel/include/devices.h @@ -4,9 +4,9 @@ #define ADDR_DEV_ROM_L 0x0000 #define ADDR_DEV_ROM_H 0x2000 -#define ADDR_DEV_USART 0x4000 -#define ADDR_DEV_CTC -#define ADDR_DEV_PIO +#define ADDR_DEV_USART 0x4000 +#define ADDR_DEV_CTC 0x4100 +#define ADDR_DEV_PIO 0x4200 #define ADDR_DEV_RAM 0x8000 diff --git a/sw/z80/kernel/include/pio.h b/sw/z80/kernel/include/pio.h new file mode 100644 index 0000000..8d72ab0 --- /dev/null +++ b/sw/z80/kernel/include/pio.h @@ -0,0 +1,18 @@ +#ifndef __PIO_H__ +#define __PIO_H__ + +#define PIO_A 0 +#define PIO_B 1 + + +void pio_data(int port, uint8_t data); +void pio_command(int port, uint8_t cmd); + +uint8_t pio_read_data(int port); + +inline int pio_read_pin(int port, uint8_t pin); +inline void pio_write_pin(int port, uint8_t pin); + +// TODO: implement mode (in/out/both) and interrupt vector + +#endif // __PIO_H__ diff --git a/sw/z80/kernel/include/serial.h b/sw/z80/kernel/include/serial.h deleted file mode 100644 index 03e2448..0000000 --- a/sw/z80/kernel/include/serial.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef __SERIAL_H__ -#define __SERIAL_H__ - -#include "types.h" -#include "devices.h" - -/* this structure is only for internal usage */ -struct _usart_device -{ - register_t buffer; // also used as LSB for divisor latch - - struct IER - { - volatile int received_data_interrupt :1; - volatile int transmitter_empty_interrupt :1; - volatile int receiver_line_status_interrupt :1; - volatile int modem_status_interrupt :1; - volatile int reserved :4; - } IER; - - struct IIR - { - volatile int interrupt_pending :1; - volatile int interrupt_id :3; - volatile int reserved :2; - volatile int fifos :2; - } IIR; - - struct FCR - { - volatile int fifo_enable :1; - volatile int receiver_fifo_rst :1; - } - - struct LCR - { - volatile int word_length :2; - volatile int stop_bits :1; - volatile int parity :1; - volatile int even_parity :1; - volatile int stick_parity :1; - volatile int break_control :1; - volatile int divisor_latch_access :1; - } LCR; - - struct MCR - { - volatile int data_terminal_ready :1; - volatile int request_to_send :1; - volatile int out1; - volatile int out2; - volatile int loop; - volatile int autoflow :1; - volatile int reserved :2; - } MCR; - - struct LSR - { - volatile int data_ready :1; - volatile int overrun_error :1; - volatile int parity_error :1; - volatile int framing_error :1; - volatile int break_interrupt :1; - volatile int transmitter_register :1; - volatile int transmitter_emtpy :1; - volatile int fifo_recv_error :1; - } LSR; - - struct MSR - { - volatile int delta_cts :1; - volatile int delta_data_set_ready :1; - volatile int trailing_edge_ring_indicator :1; - volatile int delta_data_carrier_detect :1; - volatile int clear_to_send :1; - volatile int data_set_ready :1; - volatile int ring_indicator :1; - volatile int data_carrier_detect :1; - } MSR; - - register_t scratch; -} *_usart = (_usart_device *) ADDR_DEV_USART; - - -#endif // __SERIAL__H__ diff --git a/sw/z80/kernel/include/usart.h b/sw/z80/kernel/include/usart.h new file mode 100644 index 0000000..f1f428e --- /dev/null +++ b/sw/z80/kernel/include/usart.h @@ -0,0 +1,149 @@ +#ifndef __USART_H__ +#define __USART_H__ + +#include "types.h" +#include "devices.h" + +#include "string.h" + +// baudrate clock divisors +// values from TL16C550C datasheet (table 9 for 1.8432 MHz crystal) +#define USART_BAUDRATE_50 2304 +#define USART_BAUDRATE_75 1536 +#define USART_BAUDRATE_110 1047 +#define USART_BAUDRATE_134_5 857 +#define USART_BAUDRATE_150 768 +#define USART_BAUDRATE_300 384 +#define USART_BAUDRATE_600 192 +#define USART_BAUDRATE_1200 96 +#define USART_BAUDRATE_1800 64 +#define USART_BAUDRATE_2000 58 +#define USART_BAUDRATE_2400 48 +#define USART_BAUDRATE_3600 32 +#define USART_BAUDRATE_4800 24 +#define USART_BAUDRATE_7200 16 +#define USART_BAUDRATE_9600 12 +#define USART_BAUDRATE_19200 6 +#define USART_BAUDRATE_38400 3 +#define USART_BAUDRATE_56000 3 + +// parity +#define USART_PARITY_NONE 0 +#define USART_PARITY_EVEN 1 +#define USART_PARITY_ODD 2 + +// stop bits +#define USART_STOP_BITS_1 10 +#define USART_STOP_BITS_15 15 +#define USART_STOP_BITS_2 20 + +// word lenght +#define USART_WORD_LENGTH_5 0 +#define USART_WORD_LENGTH_6 1 +#define USART_WORD_LENGTH_7 2 +#define USART_WORD_LENGTH_8 3 + +// autoflow +#define USART_AUTOFLOW_ALL 3 +#define USART_AUTOFLOW_CTS 2 +#define USART_AUTOFLOW_OFF 0 + + +/* this structure is only for internal usage */ +struct _usart_device +{ + register_t buffer; // also used as LSB for divisor latch + + struct IER + { + volatile int received_data_interrupt :1; + volatile int transmitter_empty_interrupt :1; + volatile int receiver_line_status_interrupt :1; + volatile int modem_status_interrupt :1; + volatile int reserved :4; + } IER; + + struct IIR + { + volatile int interrupt_pending :1; + volatile int interrupt_id :3; + volatile int reserved :2; + volatile int fifos :2; + } IIR; + + struct FCR + { + volatile int fifo_enable :1; + volatile int receiver_fifo_rst :1; + volatile int trasmitter_fifo_rst :1; + volatile int dma_mode_select :1; + volatile int reserved :1; + volatile int receiver_trigger :2; + } FCR; + + struct LCR + { + volatile int word_length :2; + volatile int stop_bits :1; + volatile int parity :1; + volatile int even_parity :1; + volatile int stick_parity :1; + volatile int break_control :1; + volatile int divisor_latch_access :1; + } LCR; + + struct MCR + { + volatile int data_terminal_ready :1; + volatile int request_to_send :1; + volatile int out1; + volatile int out2; + volatile int loop; + volatile int autoflow :1; + volatile int reserved :2; + } MCR; + + struct LSR + { + volatile int data_ready :1; + volatile int overrun_error :1; + volatile int parity_error :1; + volatile int framing_error :1; + volatile int break_interrupt :1; + volatile int transmitter_holder_empty :1; + volatile int transmitter_empty :1; + volatile int fifo_recv_error :1; + } LSR; + + struct MSR + { + volatile int delta_cts :1; + volatile int delta_data_set_ready :1; + volatile int trailing_edge_ring_indicator :1; + volatile int delta_data_carrier_detect :1; + volatile int clear_to_send :1; + volatile int data_set_ready :1; + volatile int ring_indicator :1; + volatile int data_carrier_detect :1; + } MSR; + + register_t scratch; +}; + + +// setup functions (wrappers) +void usart_set_baudrate(uint16_t baudrate); +void usart_set_parity(int mode); +void usart_set_stob_bits(int count); +void usart_set_word_length(int length); +void usart_set_autoflow(int mode); + +inline void usart_init(uint16_t baudrate, int parity, int stop_bits); + +void usart_transmit(uint8_t data); +uint8_t usart_receive(); + +int usart_write(uint8_t *data, size_t size); +int usart_read(uint8_t *buffer, size_t count); + +#endif // __USART__H__ diff --git a/sw/z80/kernel/kernel.c b/sw/z80/kernel/kernel.c index 3db6579..3d5aeb6 100644 --- a/sw/z80/kernel/kernel.c +++ b/sw/z80/kernel/kernel.c @@ -1,7 +1,7 @@ #include "types.h" - +#include "usart.h" void kmain(void) { - + usart_init(USART_BAUDRATE_9600, USART_PARITY_EVEN, USART_STOP_BITS_1); } diff --git a/sw/z80/kernel/pio.c b/sw/z80/kernel/pio.c new file mode 100644 index 0000000..e8c7e24 --- /dev/null +++ b/sw/z80/kernel/pio.c @@ -0,0 +1,29 @@ +#include "pio.h" + +static uint8_t *pio_port_a = (uint8_t *) ADDR_DEV_PIO; +static uint8_t *pio_port_b = (uint8_t *) ADDR_DEV_PIO + 1; +static uint8_t *pio_ctrl_a = (uint8_t *) ADDR_DEV_PIO + 2; +static uint8_t *pio_ctrl_b = (uint8_t *) ADDR_DEV_PIO + 3; + +void pio_data(int port, uint8_t data) +{ + if (port == PIO_A) + *pio_port_a = cmd; + else + *pio_port_b = cmd; +} + +void pio_command(int port, uint8_t cmd) +{ + if (port == PIO_A) + *pio_ctrl_a = cmd; + else + *pio_ctrl_b = cmd; +} + + + +inline int pio_read_pin(int port, uint8_t pin) +{ + +} diff --git a/sw/z80/kernel/usart.c b/sw/z80/kernel/usart.c new file mode 100644 index 0000000..4c2fdaf --- /dev/null +++ b/sw/z80/kernel/usart.c @@ -0,0 +1,91 @@ +#include "usart.h" + +static struct _usart_device *_usart = (struct _usart_device *) ADDR_DEV_USART; + +void usart_set_baudrate(uint16_t baudrate) +{ + // enable latch access + _usart->LCR.divisor_latch_access = 1; + _usart->buffer = 0x00FF & baudrate; // LSBs + memcpy(&_usart->IER, &(baudrate >>8), 1); + // _usart->IER = 0x00FF & (baudrate >> 8); // MSBs + _usart->LCR.divisor_latch_access = 0; +} + +void usart_set_parity(int mode) +{ + if (mode == USART_PARITY_EVEN) { + _usart->LCR.even_parity = 1; + } + else if (mode == USART_PARITY_ODD) { + _usart->LCR.even_parity = 0; + } + + _usart->LCR.parity = (mode == USART_PARITY_NONE) ? 0 : 1; +} + +void usart_set_stop_bits(int count) +{ + _usart->LCR.stop_bits = (count == USART_STOP_BITS_1) ? 0 : 1; +} + +void usart_word_length(int length) +{ + _usart->LCR.word_length = length; +} + +void usart_set_autoflow(int mode) +{ + _usart->MCR.autoflow = (mode == USART_AUTOFLOW_OFF) ? 0 : 1; + _usart->MCR.data_terminal_ready = (mode == USART_AUTOFLOW_ALL); +} + +inline void usart_init(uint16_t baudrate, int parity, int stop_bits) +{ + usart_set_baudrate(baudrate); + usart_set_parity(parity); + usart_set_stop_bits(stop_bits); + usart_set_autoflow(USART_AUTOFLOW_OFF); +} + +void usart_transmit(uint8_t data) +{ + _usart->buffer = data; + while (_usart->LSR.transmitter_holder_empty == 0); // wait +} + +uint8_t usart_receive() +{ + return _usart->buffer; +} + +int usart_write(uint8_t *data, size_t size) +{ + uint8_t *dp = data; + + while (size--) { + _usart->buffer = *(dp++); + } + while (_usart->LSR.transmitter_empty); + + // TODO: do something that actually counts for sent bytes + return size; +} + +int usart_read(uint8_t *buffer, size_t count) +{ + uint8_t *bp = buffer; + size_t read_count = 0; + + while (count--) { + *(bp++) = _usart->buffer; + // check for errors + if (_usart->LSR.framing_error || _usart->LSR.parity_error) { + bp--; // delete last byte (?) + } else { + read_count++; + } + } + + return read_count; +} diff --git a/sw/z80/libc/include/stdio.h b/sw/z80/libc/include/stdio.h new file mode 100644 index 0000000..b31cdfd --- /dev/null +++ b/sw/z80/libc/include/stdio.h @@ -0,0 +1,11 @@ +#ifndef __STDIO_H__ +#define __STDIO_H__ + +#include "types.h" + +extern uint8_t *stdout, stderr; + +void putc(char ch, uint8_t *buffer); +int printf(const char *fmt, ...); + +#endif diff --git a/sw/z80/libc/include/string.h b/sw/z80/libc/include/string.h new file mode 100644 index 0000000..f224c87 --- /dev/null +++ b/sw/z80/libc/include/string.h @@ -0,0 +1,8 @@ +#ifndef __STRING_H__ +#define __STRING_H__ + +#include "types.h" + +void *memcpy(void *dest, const void *src, size_t n); + +#endif diff --git a/sw/z80/libc/stdio.c b/sw/z80/libc/stdio.c new file mode 100644 index 0000000..c2548d6 --- /dev/null +++ b/sw/z80/libc/stdio.c @@ -0,0 +1,12 @@ +#include "stdio.h" + +void putc(char ch, uint8_t *buffer) +{ + *buffer = ch; + *(++buffer) = '\0'; +} + + +int printf(const char *fmt, ...) +{ +} diff --git a/sw/z80/libc/string.c b/sw/z80/libc/string.c new file mode 100644 index 0000000..fd6a7ff --- /dev/null +++ b/sw/z80/libc/string.c @@ -0,0 +1,13 @@ +#include "string.h" + +void *memcpy(void *dest, void *src, size_t n) +{ + char *dp = dest; + char *sp = src; + + while (n--) { + *dp++ = *sp++; + } + + return dest; +} -- cgit v1.2.1 From b96b0d6c00ea72895582ec14f9c7dccd3fe7062a Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sat, 10 Jun 2017 17:47:36 +0200 Subject: add port interface header, api still to implement fix for bug in usart.c, in function usart_write() that checked the trasmission_empty register at the wrong time causing it to overwrite the buffer. --- sw/z80/kernel/include/pio.h | 27 ++++++++++++++++++++++----- sw/z80/kernel/pio.c | 25 +++++++------------------ sw/z80/kernel/usart.c | 4 ++-- 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/sw/z80/kernel/include/pio.h b/sw/z80/kernel/include/pio.h index 8d72ab0..5d289ca 100644 --- a/sw/z80/kernel/include/pio.h +++ b/sw/z80/kernel/include/pio.h @@ -1,14 +1,31 @@ #ifndef __PIO_H__ #define __PIO_H__ -#define PIO_A 0 -#define PIO_B 1 +#include "devices.h" +#include "types.h" +#define PIO_A 0 +#define PIO_B 1 -void pio_data(int port, uint8_t data); -void pio_command(int port, uint8_t cmd); +#define PIO_MODE_0 0 +#define PIO_MODE_1 1 +#define PIO_MODE_2 2 +#define PIO_MODE_3 3 -uint8_t pio_read_data(int port); +#define PIO_INT_ACTIVE_HIGH (1<<5) +#define PIO_INT_AND_MODE (1<<6) +#define PIO_INT_ENABLE (1<<7) + + +void _pio_data(int port, uint8_t data); +void _pio_command(int port, uint8_t cmd); + +void pio_set_mode(int port, int mode); +void pio_set_interrupts(int port, int control); +void pio_set_interrupts_mask(int port, uint8_t mask); +void pio_set_io(int port, uint8_t io); + +// uint8_t pio_read_data(int port); inline int pio_read_pin(int port, uint8_t pin); inline void pio_write_pin(int port, uint8_t pin); diff --git a/sw/z80/kernel/pio.c b/sw/z80/kernel/pio.c index e8c7e24..4b9caee 100644 --- a/sw/z80/kernel/pio.c +++ b/sw/z80/kernel/pio.c @@ -1,29 +1,18 @@ #include "pio.h" -static uint8_t *pio_port_a = (uint8_t *) ADDR_DEV_PIO; -static uint8_t *pio_port_b = (uint8_t *) ADDR_DEV_PIO + 1; -static uint8_t *pio_ctrl_a = (uint8_t *) ADDR_DEV_PIO + 2; -static uint8_t *pio_ctrl_b = (uint8_t *) ADDR_DEV_PIO + 3; +static uint8_t *pio_port = (uint8_t *) ADDR_DEV_PIO; +static uint8_t *pio_ctrl = (uint8_t *) (ADDR_DEV_PIO + 2); -void pio_data(int port, uint8_t data) +void _pio_data(int port, uint8_t data) { - if (port == PIO_A) - *pio_port_a = cmd; - else - *pio_port_b = cmd; + *(pio_port + port) = data; } -void pio_command(int port, uint8_t cmd) +void _pio_command(int port, uint8_t cmd) { - if (port == PIO_A) - *pio_ctrl_a = cmd; - else - *pio_ctrl_b = cmd; + *(pio_ctrl + port) = cmd; } - - -inline int pio_read_pin(int port, uint8_t pin) +void pio_set_mode(int port, int mode) { - } diff --git a/sw/z80/kernel/usart.c b/sw/z80/kernel/usart.c index 4c2fdaf..9ec6dbd 100644 --- a/sw/z80/kernel/usart.c +++ b/sw/z80/kernel/usart.c @@ -65,8 +65,8 @@ int usart_write(uint8_t *data, size_t size) while (size--) { _usart->buffer = *(dp++); + while (_usart->LSR.transmitter_empty); } - while (_usart->LSR.transmitter_empty); // TODO: do something that actually counts for sent bytes return size; @@ -83,7 +83,7 @@ int usart_read(uint8_t *buffer, size_t count) if (_usart->LSR.framing_error || _usart->LSR.parity_error) { bp--; // delete last byte (?) } else { - read_count++; + read_count++; } } -- cgit v1.2.1 From 56b138ee24fcb2bdfab751d681c2f842cfb9e77b Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Thu, 15 Jun 2017 14:17:10 +0200 Subject: new documentation in z80upc.pdf --- doc/report/build.cmd | 4 - doc/report/build/notes.pdf | Bin 39689 -> 47404 bytes doc/report/build/z80uPC.pdf | Bin 29047 -> 970520 bytes doc/report/res/addrspace.pdf | Bin 6465 -> 7208 bytes doc/report/res/addrspace.svg | 83 ++--- doc/report/res/block_diagram.pdf | Bin 0 -> 23233 bytes doc/report/res/block_diagram.svg | 639 +++++++++++++++++++++++++++++++++++++++ doc/report/res/bus_displays.png | Bin 0 -> 7776 bytes doc/report/res/iospace.pdf | Bin 0 -> 6118 bytes doc/report/res/iospace.svg | 102 +++---- doc/report/res/logo_sam.pdf | Bin 0 -> 891254 bytes doc/report/z80uPC.tex | 290 +++++++++++++++++- 12 files changed, 1022 insertions(+), 96 deletions(-) delete mode 100644 doc/report/build.cmd create mode 100644 doc/report/res/block_diagram.pdf create mode 100644 doc/report/res/block_diagram.svg create mode 100644 doc/report/res/bus_displays.png create mode 100644 doc/report/res/iospace.pdf create mode 100755 doc/report/res/logo_sam.pdf diff --git a/doc/report/build.cmd b/doc/report/build.cmd deleted file mode 100644 index 3b4e8cd..0000000 --- a/doc/report/build.cmd +++ /dev/null @@ -1,4 +0,0 @@ -@echo off - - lualatex --output-directory=build notes.tex -pause \ No newline at end of file diff --git a/doc/report/build/notes.pdf b/doc/report/build/notes.pdf index b0f0ec4..6a70bd5 100644 Binary files a/doc/report/build/notes.pdf and b/doc/report/build/notes.pdf differ diff --git a/doc/report/build/z80uPC.pdf b/doc/report/build/z80uPC.pdf index 38b7bcd..6c5dd23 100644 Binary files a/doc/report/build/z80uPC.pdf and b/doc/report/build/z80uPC.pdf differ diff --git a/doc/report/res/addrspace.pdf b/doc/report/res/addrspace.pdf index 2689fca..96ac657 100644 Binary files a/doc/report/res/addrspace.pdf and b/doc/report/res/addrspace.pdf differ diff --git a/doc/report/res/addrspace.svg b/doc/report/res/addrspace.svg index 6af7e7f..0f73784 100644 --- a/doc/report/res/addrspace.svg +++ b/doc/report/res/addrspace.svg @@ -9,12 +9,12 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="210mm" - height="297mm" - viewBox="0 0 210 297" + width="180.64061mm" + height="257.56342mm" + viewBox="0 0 180.64061 257.56342" version="1.1" id="svg8" - inkscape:version="0.92.0 r" + inkscape:version="0.92.1 r" sodipodi:docname="addrspace.svg"> @@ -25,18 +25,22 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="0.47482464" - inkscape:cx="396.85039" - inkscape:cy="477.01822" + inkscape:zoom="0.33575172" + inkscape:cx="902.43963" + inkscape:cy="551.46623" inkscape:document-units="mm" inkscape:current-layer="layer1" showgrid="false" showborder="false" - inkscape:window-width="1246" - inkscape:window-height="743" - inkscape:window-x="15" - inkscape:window-y="38" - inkscape:window-maximized="0" /> + inkscape:window-width="1266" + inkscape:window-height="763" + inkscape:window-x="5" + inkscape:window-y="28" + inkscape:window-maximized="0" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> @@ -52,7 +56,8 @@ + id="layer1" + transform="translate(52.640604,-39.436588)"> @@ -82,78 +87,80 @@ + y="44.92416" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.05277824px;font-family:'Roboto Mono';-inkscape-font-specification:'Roboto Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;writing-mode:lr-tb;text-anchor:middle;stroke-width:0.26458332" /> 0x0000 + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:13.05277824px;font-family:'Roboto Mono';-inkscape-font-specification:'Roboto Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:center;writing-mode:lr-tb;text-anchor:middle;stroke-width:0.26458332">0x0000 0x2000 0x4000 0x8000 0xFFFF + id="tspan4611" + x="-30.085047" + y="296.85013">0xFFFF 32KB RAM SPACE 8KB ROM + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + Z80CPU + + + ROM HIGH + + + ROM LOW + + + RAM + + + + D0-8 + + + A0-11 + + + MMU + + + A12-15 + + A12-15 + + CLKGenerators + + + + PIO + CTC + + + + + + + + + + + + + + + + + + + + + + + + + + USART + + MAX214 + + + + + + + + + + + + + + + + + + + + + + + + + + D0-3 + + + A0-1 + + A0-1 + + + diff --git a/doc/report/res/bus_displays.png b/doc/report/res/bus_displays.png new file mode 100644 index 0000000..941fa4f Binary files /dev/null and b/doc/report/res/bus_displays.png differ diff --git a/doc/report/res/iospace.pdf b/doc/report/res/iospace.pdf new file mode 100644 index 0000000..c1773fd Binary files /dev/null and b/doc/report/res/iospace.pdf differ diff --git a/doc/report/res/iospace.svg b/doc/report/res/iospace.svg index 750c51c..4438ed0 100644 --- a/doc/report/res/iospace.svg +++ b/doc/report/res/iospace.svg @@ -9,12 +9,12 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="210mm" - height="297mm" - viewBox="0 0 210 297" + width="152.99294mm" + height="262.63849mm" + viewBox="0 0 152.99294 262.63849" version="1.1" id="svg8" - inkscape:version="0.91 r13725" + inkscape:version="0.92.1 r" sodipodi:docname="iospace.svg"> @@ -25,18 +25,22 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="2.6860138" - inkscape:cx="135.42682" - inkscape:cy="112.15076" + inkscape:zoom="0.67150345" + inkscape:cx="420.75058" + inkscape:cy="512.06936" inkscape:document-units="mm" inkscape:current-layer="layer1" showgrid="false" showborder="false" - inkscape:window-width="1920" - inkscape:window-height="1017" - inkscape:window-x="-8" - inkscape:window-y="-8" - inkscape:window-maximized="1" /> + inkscape:window-width="1266" + inkscape:window-height="763" + inkscape:window-x="5" + inkscape:window-y="28" + inkscape:window-maximized="0" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> @@ -45,14 +49,15 @@ image/svg+xml - + + id="layer1" + transform="translate(24.867916,-38.353672)"> - 0x4000 + y="236.93015" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;line-height:6.61000013;font-family:'Roboto Mono';-inkscape-font-specification:'Roboto Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start">0x4000 0x8000 + y="300.93015" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;line-height:6.61000013;font-family:'Roboto Mono';-inkscape-font-specification:'Roboto Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start">0x8000 0x6000 + id="tspan4159" + x="-25.317501" + y="268.93015" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;line-height:6.61000013;font-family:'Roboto Mono';-inkscape-font-specification:'Roboto Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start">0x6000 0x5000 + y="252.93015" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;line-height:6.61000013;font-family:'Roboto Mono';-inkscape-font-specification:'Roboto Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start">0x5000 0x7000 + id="tspan4227" + x="-25.317501" + y="284.93015" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;line-height:6.61000013;font-family:'Roboto Mono';-inkscape-font-specification:'Roboto Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start">0x7000 SERIAL + id="tspan4167" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:6.3499999px;line-height:6.61000013;font-family:'Roboto Mono';-inkscape-font-specification:'Roboto Mono, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;writing-mode:lr-tb;text-anchor:start">SERIAL diff --git a/doc/report/res/logo_sam.pdf b/doc/report/res/logo_sam.pdf new file mode 100755 index 0000000..b621307 Binary files /dev/null and b/doc/report/res/logo_sam.pdf differ diff --git a/doc/report/z80uPC.tex b/doc/report/z80uPC.tex index aa5d13c..5a4ec64 100644 --- a/doc/report/z80uPC.tex +++ b/doc/report/z80uPC.tex @@ -1,10 +1,296 @@ \documentclass[a4paper, 11pt, twoside]{article} +\usepackage{array} +\usepackage{float} +\usepackage{wrapfig} +% source code +\usepackage{listings} -\title{Z80 Single Board Computer Development} +% set correct hypenation +\usepackage[italian]{babel} + +% set margins +\usepackage[ + inner=2.5cm, + outer=2.5cm, + top=3cm, + bottom=3.75cm +]{geometry} + +% set headers +\usepackage{fancyhdr} +\pagestyle{fancyplain} +\fancyhf{} +\setlength{\headheight}{1.3cm} +\rhead{\includegraphics[height=1.25cm]{res/logo_sam}} +\lfoot{SAM 3E - Naoki Pross} +\rfoot{\thepage} + +% set font +\usepackage{fontspec} +\setmainfont{Roboto} +\setmonofont{Roboto Mono} + +% to fix macros +\usepackage{xspace} +% commands +% macro for project name +\newcommand{\prj}{Z80μPC\xspace} + +% invert signal (not, active low) +\newcommand{\inv}[1]{$\overline{\mbox{#1}}$} + +% metadata +\title{\vspace{-1cm}\texttt{\prj} Single Board \\ Computer Development } \author{Naoki Pross} +% document \begin{document} - \maketitle + +\maketitle +\begin{abstract} + Lo Zilog Z80 \`e un processore a 8 bit che fu introdotto nel 1976 che ebbe + un grandissimo successo nel mondo dell'elettronica e dell'informatica + nella fine del 20esimo secolo. In memoria di questo processore pioniere + dell'industria di sistemi embedded ho deciso di costruire un computer a + scopo generico intorno a questa piattaforma. L'obiettivo \`e di realizzare + una scheda programmabile con tutti i componenti necessari come ROM, RAM e + timers per far funzionare del software programmato se possibile sul + dispositivo stesso. +\end{abstract} + +\section{Specifiche tecniche dello Z80} +Lo Z80 \`e un processore molto minimalistico se paragonato a ci\`o che si +trova oggi sul mercato dei microcontrollori. Per il mio progetto ho deciso di +utilizzare il modello originale \texttt{Zilog Z8400} che non dispone di +sistemi integrati come i modelli SoC odierni. Le specifiche pi\`u importanti +sono elencate a seguire. + +\begin{itemize} + \item Architettura a 8 bit con bus a 16 bit con 64K indirizzi indirizzabili + \item Registri a 16 bit per {\tt SP,PC} e registri di utilizzo generico a + 8 bit {\tt A..F} combinabili a coppie {\tt AF,BC,..} per utilizzare + valori a 16 bit + \item Clock fino a 8 MHz + \item Segnali di controllo tra cui \texttt{\inv{RD}, \inv{WR}, + \inv{IOREQ}, \inv{MREQ}} e \texttt{\inv{RST}} + \item Interrupts mascherabili e non con vettore a 8 bit +\end{itemize} + +\section{Architettura di base} +Il minimo necessario per far funzionare un computer con lo Z80 sono una ROM e +una RAM, ma per il mio progetto ho scelto di aggiungere dell'hardware +aggiuntivo per lo sviluppo si sistemi pi\`u complessi per apprendere +conoscenze sia nel mondo dell'elettronica che dell'informatica. Per questa +ragione lo \prj possiede i seguienti componenti: + +\begin{center} +\begin{tabular}{ >{\tt}l >{\tt\bfseries}l p{.7\linewidth} } + % \hline \\ + ROM & M28C64 & EEPROM da 8KB x 8 bit (64K) per il BIOS / Bootloader / + OS installata doppia per avere 16KB \\ + RAM & HM62256B & SRAM da 32KB x 8bit (256K) \\ + CTC & Z8430 & Counter timer circuit ufficiale di Zilog a 4 canali che + permette di essere programmato \\ + PIO & Z8420 & Parallel input/output controller di Zilog per avere un + intefaccia digitale con due porte da 8 bit \\ + MMU & M4-32/32-15JC & CPLD programmabile che implementa una memory + management unit semplificata in grado di gestire i 5 + bit pi\`u significativi della linea di indirizzi \\ + USART & TL16C550C & Interfaccia USART per poter comunicare utilizzando il + protocollo RS232 +\end{tabular} +\end{center} + +Oltre a tutto ci\`o per uno scopo formativo lo \prj dispone anche di strumenti +da debug e analisi per comprendere ogni operazione del processore. Il modello +di Z80 scelto \`e in grado di utilizzare un clock fino a 8MHz, ma non +definisce un minimo dunque sono presenti 3 circuiti che generano 3 clock di +velocit\`a differenti. + +\begin{center} +\begin{tabular}{ >{\bfseries}r p{.8\linewidth} } + 0Hz & Questo clock \`e un bottone che permette di creare + manualmente le pulsazioni del clock, per poter analizzare + ogni istruzione \\ + 200Hz & Mediante un classico circuito con un LM555 si ha un clock da + 200Hz per eseguire i programmi a velocit\`a rallentata \\ + 4MHz & Clock per esecuzione a velocit\`a piena (normale) +\end{tabular} +\end{center} + +Una seconda disposizione per aiutare la comprensione del funzionamento del +processore \`e data da 6 display a 7 segmenti che durante l'esecuzione +rallentata o a step (bottone) visualizzano i bytes presenti sulla bus di +indirizzi a 16 bit e sul bus di dati a 8 bit. + +\begin{figure}[!h] \centering + \includegraphics[width=\linewidth]{res/bus_displays} + \caption{Display a 7 segmenti per visualizzare il flusso di dati della + CPU} +\end{figure} + +\section{Memory Management Unit} + +Alcuni modelli successori dello Z8400 implementavano una MMU SoC che +permetteva di indirizzare un address space di dimensione maggiore. Per lo \prj +non necessito di un indirizzamento pi\`u grande ma piuttosto sono interessato +dalle operazioni di gestione della memoria di una MMU simile a ci\`o che +accade nelle architetture X86. Nelle architetture odierne basate sull'X86/64 +\`e presente un sistema di traslazione di indirizzi di memoria da virtuale a +fisica. Con lo scopo di trarne solamente i vantaggi pi\`u fondamentali lo \prj +implementa nella CPLD MMU un sistema basilare di gestione di pagine di memoria +con traslazione di indirizzi in modo da poter allocare pi\`u programmi nella +RAM anche se il sistema non implementa il multitasking. + +% TODO: write about this in more details + +\subsection{Address Space} + +\begin{wrapfigure}{r}{.4\linewidth} \centering + \vspace{8mm} + \includegraphics[width=.9\linewidth]{res/addrspace} + \vspace{4mm} + \caption{Address space dello \prj} +\end{wrapfigure} +La funzione primaria della MMU \`e di mappare i dispositivi I/O e le memorie +nell'address space. Nell'implementazione reale la MMU controlla i segnali {\tt +\inv{CS}} seguendo una logica combinatoria molto semplice che controlla se +l'indirizzo sul bus si trova in una zona definita per un dispositivo. +L'address space si presenta dunque nella seguente maniera, per cui la ROM +occupa il primo quarto, i dispositivi mappabili il secondo quarto e la RAM la +met\`a restante. Essendo un progetto pensato per essere esteso 16KB sono +liberi per mappare dispositivi esterni collegati attraverso il connettore +DIN41612. + +% \begin{wrapfigure}{l}{.4\linewidth} \centering +% \includegraphics[width=.8\linewidth]{res/iospace} +% \end{wrapfigure} + +\subsection{Page Table} + +Per poter controllare la traslazione degli indirizzi la MMU dispone di una +Page Table a cui \`e possibile accedere attraversso un certo indirizzo +nell'I/O space. La page table di 5 bit permette la gestione delle regioni di +memoria da impostare per dei determinati processi. Questa funzione \`e +importante perch\`e permette la separazione dello stack e della memoria della +kernel dai programmi normali. Per lo \prj potrebbe sembrare eccessivo ma +essendo uno strumento per apprendere le fondamenta dell'elettronica e +dell'informatica \`e interessante implementare questa funzionalit\`a che +comunque se necessario pu\`o essere disabilitata. + +\section{Schema a blocchi} + +\begin{figure}[!h] \centering + \includegraphics[width=.85\linewidth]{res/block_diagram} +\end{figure} + +\section{Software / Sistema operativo} + +Negli sviluppi pi\`u recenti intorno allo Z80 esso veniva utilizzato come un +microcontrollore anzich\`e come processore da computer, per questa ragione non +sono presenti molti sistemi operativi per questa piattaforma. Dunque per lo +\prj il progetti implementa un sistema operativo soprannominato {\tt +HelvetiOS} con le funzioni minime necessarie come un interfaccia seriale a +comandi e un meccanismo per caricare i programmi. + +\subsection{Componenti di base} + +Per garantire un funzionamento minimo il sistema {\tt HelvetiOS} deve offrire +drivers e utility di base quali: + +\begin{center} +\begin{minipage}[t]{.4\linewidth} + \begin{itemize} + \item USART driver and API + \item PIO driver and API + \item CTC driver and API + \end{itemize} +\end{minipage}% +\begin{minipage}[t]{.4\linewidth} + \begin{itemize} + \item Bootloader + \item Program launcher + \item Shell-like interface + \end{itemize} +\end{minipage} +\end{center} + +\subsection{Interfacce dell'API} + +\subsubsection{USART} +\begin{lstlisting}[language=C, basicstyle=\ttfamily] +void usart_set_baudrate(uint16_t baudrate); +void usart_set_parity(int mode); +void usart_set_stop_bits(int count); +void usart_set_word_length(int length); +void usart_set_autoflow(int mode); + +inline void usart_init(uint16_t baudrate, int parity, int stop_bits); + +void usart_transmit(uint8_t data); +uint8_t usart_receive(); + +int usart_write(uint8_t *data, size_t size); +int usart_read(uint8_t *buffer, size_t count); +\end{lstlisting} + +% \subsection{PIO} + +\subsection{Toolchain per la compilazione} + +Per compilare il software del progetto si utilizza SDCC, un progetto +open-source che supporta la compilazione di binari per l'architettura dello +Z80. Nella mia configurazione utilizzo GNU make con il seguente makefile. + +\newpage +\begin{lstlisting}[language=make, numbers=left, basicstyle=\ttfamily] +#### +# Source code settings +# +OSNAME := helvetiOS + +CSOURCES := $(wildcard kernel/*.c) $(wildcard libc/*.c) +OBJECTS := $(patsubst %.c,build/%.rel,$(CSOURCES)) +HEXFILE := build/$(OSNAME).hex +BINARY := build/$(OSNAME).bin + +### +# Compiler settings + +CC := sdcc + +CFLAGS := -mz80 \ + -I kernel/include -I libc/include -DDEBUG + +LDFLAGS := -mz80 --no-std-crt0 crt0.rel \ + --code-loc 0x0800 --data-loc 0x8000 + +.PHONY: dirs dis clean +all: $(BINARY) + +# build binary +$(BINARY): $(OBJECTS) dirs + $(CC) $(LDFLAGS) $(OBJECTS) -o $(HEXFILE) + xxd -r -p $(HEXFILE) $(BINARY) + +$(OBJECTS): build/%.rel : %.c $(CSOURCES) dirs crt0.rel + $(CC) $(CFLAGS) -c $< -o $@ + +crt0.rel: crt0.s + sdasz80 -o $< + +dirs: + mkdir -p build build/kernel build/libc + +dis: $(BINARY) + z80dasm -a -g 0h $< -o $(OSNAME).s + +clean: + - rm -rd build/* + - rm $(OSNAME).s + - rm crt0.rel +\end{lstlisting} + \end{document} -- cgit v1.2.1 From 436e259b4c3d687bab51cc8ca35fe61103b430a2 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Fri, 16 Jun 2017 13:51:06 +0200 Subject: fixed typo in usart.h and in doc --- doc/report/build/notes.pdf | Bin 47404 -> 47404 bytes doc/report/build/z80uPC.pdf | Bin 970520 -> 970633 bytes doc/report/z80uPC.tex | 3 +++ sw/z80/kernel/include/usart.h | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/report/build/notes.pdf b/doc/report/build/notes.pdf index 6a70bd5..5a43c7d 100644 Binary files a/doc/report/build/notes.pdf and b/doc/report/build/notes.pdf differ diff --git a/doc/report/build/z80uPC.pdf b/doc/report/build/z80uPC.pdf index 6c5dd23..aff4174 100644 Binary files a/doc/report/build/z80uPC.pdf and b/doc/report/build/z80uPC.pdf differ diff --git a/doc/report/z80uPC.tex b/doc/report/z80uPC.tex index 5a4ec64..eaad987 100644 --- a/doc/report/z80uPC.tex +++ b/doc/report/z80uPC.tex @@ -219,6 +219,9 @@ drivers e utility di base quali: \subsection{Interfacce dell'API} +Nel corso dello sviluppo questa sezione verr\`a continuamente espansa per +documentare le interfacce dei vari drivers. + \subsubsection{USART} \begin{lstlisting}[language=C, basicstyle=\ttfamily] void usart_set_baudrate(uint16_t baudrate); diff --git a/sw/z80/kernel/include/usart.h b/sw/z80/kernel/include/usart.h index f1f428e..3e5c070 100644 --- a/sw/z80/kernel/include/usart.h +++ b/sw/z80/kernel/include/usart.h @@ -134,7 +134,7 @@ struct _usart_device // setup functions (wrappers) void usart_set_baudrate(uint16_t baudrate); void usart_set_parity(int mode); -void usart_set_stob_bits(int count); +void usart_set_stop_bits(int count); void usart_set_word_length(int length); void usart_set_autoflow(int mode); -- cgit v1.2.1