diff options
Diffstat (limited to 'sw')
34 files changed, 1266 insertions, 334 deletions
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 @@ +<SYNPROJ_Revision_Control> +<RevisionControl_Info/> +</SYNPROJ_Revision_Control> 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 Binary files differdeleted file mode 100644 index ab6deb9..0000000 --- a/sw/pld/ADDRESS_DECODER.abs +++ /dev/null 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) ; 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 <stdio.h> + #include <stdlib.h> + + #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<<MY_DEVICE_FLAG_RDY))); + + if (_my_dev.flags & (1<<MY_DEVICE_FLAG_ERR)) { + return -1; + } + } + + return i; + } diff --git a/sw/z80/crt0.s b/sw/z80/crt0.s index d0ae3ca..00c7da1 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 _kmain + + .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 _kmain + 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/devices.h b/sw/z80/kernel/include/devices.h new file mode 100644 index 0000000..e8c183f --- /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 0x4100 +#define ADDR_DEV_PIO 0x4200 + +#define ADDR_DEV_RAM 0x8000 + +#endif diff --git a/sw/z80/kernel/include/pio.h b/sw/z80/kernel/include/pio.h new file mode 100644 index 0000000..5d289ca --- /dev/null +++ b/sw/z80/kernel/include/pio.h @@ -0,0 +1,35 @@ +#ifndef __PIO_H__ +#define __PIO_H__ + +#include "devices.h" +#include "types.h" + +#define PIO_A 0 +#define PIO_B 1 + +#define PIO_MODE_0 0 +#define PIO_MODE_1 1 +#define PIO_MODE_2 2 +#define PIO_MODE_3 3 + +#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); + +// TODO: implement mode (in/out/both) and interrupt vector + +#endif // __PIO_H__ diff --git a/sw/z80/kernel/include/types.h b/sw/z80/kernel/include/types.h index adde214..552b7e9 100644 --- a/sw/z80/kernel/include/types.h +++ b/sw/z80/kernel/include/types.h @@ -1,9 +1,13 @@ #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 #define uint16_t unsigned int +#define size_t uint16_t + #endif diff --git a/sw/z80/kernel/include/usart.h b/sw/z80/kernel/include/usart.h new file mode 100644 index 0000000..3e5c070 --- /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_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); + +#endif // __USART__H__ diff --git a/sw/z80/kernel/kernel.c b/sw/z80/kernel/kernel.c index fe87c3d..3d5aeb6 100644 --- a/sw/z80/kernel/kernel.c +++ b/sw/z80/kernel/kernel.c @@ -1,10 +1,7 @@ #include "types.h" +#include "usart.h" - -void main(void) +void kmain(void) { - int i, j = 20; - for (i = 0; i < 10; i++) { - j--; - } + 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..4b9caee --- /dev/null +++ b/sw/z80/kernel/pio.c @@ -0,0 +1,18 @@ +#include "pio.h" + +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) +{ + *(pio_port + port) = data; +} + +void _pio_command(int port, uint8_t cmd) +{ + *(pio_ctrl + port) = cmd; +} + +void pio_set_mode(int port, int mode) +{ +} diff --git a/sw/z80/kernel/usart.c b/sw/z80/kernel/usart.c new file mode 100644 index 0000000..9ec6dbd --- /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/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/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; +} 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 |