STAR-future commited on
Commit
bc2da72
·
verified ·
1 Parent(s): 47184fe

add chips/openroad_flow_scripts (part 3)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +2 -0
  2. chips/openroad_flow_scripts/flow/designs/sky130hs/gcd/constraint.sdc +19 -0
  3. chips/openroad_flow_scripts/flow/designs/sky130hs/ibex/config.mk +20 -0
  4. chips/openroad_flow_scripts/flow/designs/sky130hs/ibex/constraint.sdc +19 -0
  5. chips/openroad_flow_scripts/flow/designs/sky130hs/jpeg/config.mk +23 -0
  6. chips/openroad_flow_scripts/flow/designs/sky130hs/jpeg/constraint.sdc +19 -0
  7. chips/openroad_flow_scripts/flow/designs/sky130hs/riscv32i/config.mk +19 -0
  8. chips/openroad_flow_scripts/flow/designs/sky130hs/riscv32i/constraint.sdc +22 -0
  9. chips/openroad_flow_scripts/flow/designs/sky130hs/riscv32i/fastroute.tcl +3 -0
  10. chips/openroad_flow_scripts/flow/designs/src/aes/LICENSE +26 -0
  11. chips/openroad_flow_scripts/flow/designs/src/aes/README.md +13 -0
  12. chips/openroad_flow_scripts/flow/designs/src/aes/aes_cipher_top.v +253 -0
  13. chips/openroad_flow_scripts/flow/designs/src/aes/aes_inv_cipher_top.v +324 -0
  14. chips/openroad_flow_scripts/flow/designs/src/aes/aes_inv_sbox.v +325 -0
  15. chips/openroad_flow_scripts/flow/designs/src/aes/aes_key_expand_128.v +84 -0
  16. chips/openroad_flow_scripts/flow/designs/src/aes/aes_rcon.v +93 -0
  17. chips/openroad_flow_scripts/flow/designs/src/aes/aes_sbox.v +326 -0
  18. chips/openroad_flow_scripts/flow/designs/src/aes/timescale.v +1 -0
  19. chips/openroad_flow_scripts/flow/designs/src/ariane/LICENSE +176 -0
  20. chips/openroad_flow_scripts/flow/designs/src/ariane/README.md +13 -0
  21. chips/openroad_flow_scripts/flow/designs/src/ariane/ariane.sv2v.v +0 -0
  22. chips/openroad_flow_scripts/flow/designs/src/ariane133/ariane.sv2v.v +0 -0
  23. chips/openroad_flow_scripts/flow/designs/src/ariane136/LICENSE +176 -0
  24. chips/openroad_flow_scripts/flow/designs/src/ariane136/README.md +14 -0
  25. chips/openroad_flow_scripts/flow/designs/src/ariane136/ariane.sv2v.v +0 -0
  26. chips/openroad_flow_scripts/flow/designs/src/black_parrot/LICENSE +24 -0
  27. chips/openroad_flow_scripts/flow/designs/src/black_parrot/README.md +13 -0
  28. chips/openroad_flow_scripts/flow/designs/src/black_parrot/pickled.v +0 -0
  29. chips/openroad_flow_scripts/flow/designs/src/bp_be_top/LICENSE +24 -0
  30. chips/openroad_flow_scripts/flow/designs/src/bp_be_top/README.md +13 -0
  31. chips/openroad_flow_scripts/flow/designs/src/bp_be_top/pickled.v +0 -0
  32. chips/openroad_flow_scripts/flow/designs/src/bp_fe_top/LICENSE +24 -0
  33. chips/openroad_flow_scripts/flow/designs/src/bp_fe_top/README.md +13 -0
  34. chips/openroad_flow_scripts/flow/designs/src/bp_fe_top/pickled.v +0 -0
  35. chips/openroad_flow_scripts/flow/designs/src/bp_multi_top/LICENSE +24 -0
  36. chips/openroad_flow_scripts/flow/designs/src/bp_multi_top/README.md +13 -0
  37. chips/openroad_flow_scripts/flow/designs/src/bp_multi_top/pickled.v +0 -0
  38. chips/openroad_flow_scripts/flow/designs/src/bp_quad/bsg_chip_block.sv2v.v +3 -0
  39. chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/AHBlite_GPIO.v +165 -0
  40. chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/AHBlite_bus0.v +77 -0
  41. chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/AHBlite_db_reg.v +101 -0
  42. chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/AHBlite_sys_0.v +321 -0
  43. chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/APB_sys_0/AHB_2_APB.v +214 -0
  44. chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/APB_sys_0/APB_PWM32.v +112 -0
  45. chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/APB_sys_0/APB_TIMER32.v +142 -0
  46. chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/APB_sys_0/APB_WDT32.v +124 -0
  47. chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/APB_sys_0/APB_bus0.v +236 -0
  48. chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/APB_sys_0/APB_sys_0.v +760 -0
  49. chips/openroad_flow_scripts/flow/designs/src/chameleon/IPs/AHBSRAM.v +334 -0
  50. chips/openroad_flow_scripts/flow/designs/src/chameleon/IPs/APB_I2C.v +86 -0
.gitattributes CHANGED
@@ -3032,3 +3032,5 @@ chips/skywater_sky130_pdk/libraries/sky130_fd_pr/latest/cells/rf_nfet_20v0_withp
3032
  chips/skywater_sky130_pdk/libraries/sky130_fd_pr/latest/cells/rf_nfet_20v0_withptap_iso/sky130_fd_pr__rf_nfet_20v0_withptap_iso.gds filter=lfs diff=lfs merge=lfs -text
3033
  chips/skywater_sky130_pdk/libraries/sky130_fd_pr/latest/cells/rf_pfet_20v0_withptap/sky130_fd_pr__rf_pfet_20v0_withptap.gds filter=lfs diff=lfs merge=lfs -text
3034
  chips/openroad_flow_scripts/flow/designs/nangate45/bp_quad/bsg_chip_block.sv2v.v filter=lfs diff=lfs merge=lfs -text
 
 
 
3032
  chips/skywater_sky130_pdk/libraries/sky130_fd_pr/latest/cells/rf_nfet_20v0_withptap_iso/sky130_fd_pr__rf_nfet_20v0_withptap_iso.gds filter=lfs diff=lfs merge=lfs -text
3033
  chips/skywater_sky130_pdk/libraries/sky130_fd_pr/latest/cells/rf_pfet_20v0_withptap/sky130_fd_pr__rf_pfet_20v0_withptap.gds filter=lfs diff=lfs merge=lfs -text
3034
  chips/openroad_flow_scripts/flow/designs/nangate45/bp_quad/bsg_chip_block.sv2v.v filter=lfs diff=lfs merge=lfs -text
3035
+ chips/openroad_flow_scripts/flow/designs/src/bp_quad/bsg_chip_block.sv2v.v filter=lfs diff=lfs merge=lfs -text
3036
+ chips/openroad_flow_scripts/flow/designs/src/coyote/coyote.sv2v.v filter=lfs diff=lfs merge=lfs -text
chips/openroad_flow_scripts/flow/designs/sky130hs/gcd/constraint.sdc ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ current_design gcd
2
+
3
+ set clk_name core_clock
4
+ set clk_port_name clk
5
+ set clk_period 1.4
6
+ set clk_io_pct 0.2
7
+
8
+ set clk_port [get_ports $clk_port_name]
9
+
10
+ create_clock -name $clk_name -period $clk_period $clk_port
11
+ set clk_io_name vclk_$clk_name
12
+ create_clock -name $clk_io_name -period $clk_period
13
+ set_clock_latency 0.235 [get_clocks $clk_name]
14
+ set_clock_latency 0.235 [get_clocks $clk_io_name]
15
+
16
+ set non_clock_inputs [all_inputs -no_clocks]
17
+
18
+ set_input_delay [expr $clk_period * $clk_io_pct] -clock $clk_io_name $non_clock_inputs
19
+ set_output_delay [expr $clk_period * $clk_io_pct] -clock $clk_io_name [all_outputs]
chips/openroad_flow_scripts/flow/designs/sky130hs/ibex/config.mk ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export DESIGN_NICKNAME = ibex
2
+ export DESIGN_NAME = ibex_core
3
+ export PLATFORM = sky130hs
4
+
5
+ export VERILOG_FILES = $(sort $(wildcard $(DESIGN_HOME)/src/ibex_sv/*.sv)) \
6
+ $(DESIGN_HOME)/src/ibex_sv/syn/rtl/prim_clock_gating.v
7
+
8
+ export VERILOG_INCLUDE_DIRS = \
9
+ $(DESIGN_HOME)/src/ibex_sv/vendor/lowrisc_ip/prim/rtl/
10
+
11
+ export SYNTH_HDL_FRONTEND = slang
12
+
13
+ export SDC_FILE = $(DESIGN_HOME)/$(PLATFORM)/$(DESIGN_NICKNAME)/constraint.sdc
14
+
15
+ export CORE_UTILIZATION = 60
16
+ export PLACE_DENSITY_LB_ADDON = 0.20
17
+ export TNS_END_PERCENT = 100
18
+ export SETUP_REPAIR_PHASES = PARALLEL_EVAL
19
+ export GPL_PLACE_IOS = 1
20
+
chips/openroad_flow_scripts/flow/designs/sky130hs/ibex/constraint.sdc ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ current_design ibex_core
2
+
3
+ set clk_name core_clock
4
+ set clk_port_name clk_i
5
+ set clk_period 6.5
6
+ set clk_io_pct 0.2
7
+
8
+ set clk_port [get_ports $clk_port_name]
9
+
10
+ create_clock -name $clk_name -period $clk_period $clk_port
11
+ set clk_io_name vclk_$clk_name
12
+ create_clock -name $clk_io_name -period $clk_period
13
+ set_clock_latency 0.785 [get_clocks $clk_name]
14
+ set_clock_latency 0.785 [get_clocks $clk_io_name]
15
+
16
+ set non_clock_inputs [all_inputs -no_clocks]
17
+
18
+ set_input_delay [expr $clk_period * $clk_io_pct] -clock $clk_io_name $non_clock_inputs
19
+ set_output_delay [expr $clk_period * $clk_io_pct] -clock $clk_io_name [all_outputs]
chips/openroad_flow_scripts/flow/designs/sky130hs/jpeg/config.mk ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export DESIGN_NICKNAME = jpeg
2
+ export DESIGN_NAME = jpeg_encoder
3
+ export PLATFORM = sky130hs
4
+
5
+ export VERILOG_FILES = $(sort $(wildcard $(DESIGN_HOME)/src/$(DESIGN_NICKNAME)/*.v))
6
+ export VERILOG_INCLUDE_DIRS = $(DESIGN_HOME)/src/$(DESIGN_NICKNAME)/include
7
+ export SDC_FILE = $(DESIGN_HOME)/$(PLATFORM)/$(DESIGN_NICKNAME)/constraint.sdc
8
+ export ABC_AREA = 1
9
+
10
+ export CORE_UTILIZATION = 50
11
+ export CORE_ASPECT_RATIO = 1
12
+ export CORE_MARGIN = 2
13
+
14
+ export PLACE_DENSITY_LB_ADDON = 0.25
15
+ export TNS_END_PERCENT = 100
16
+ export SETUP_REPAIR_PHASES = PARALLEL_EVAL
17
+
18
+ export CTS_CLUSTER_SIZE = 30
19
+ export CTS_CLUSTER_DIAMETER = 50
20
+
21
+ export SWAP_ARITH_OPERATORS = 1
22
+ export OPENROAD_HIERARCHICAL = 1
23
+
chips/openroad_flow_scripts/flow/designs/sky130hs/jpeg/constraint.sdc ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ current_design jpeg_encoder
2
+
3
+ set clk_name clk
4
+ set clk_port_name clk
5
+ set clk_period 3.5
6
+ set clk_io_pct 0.2
7
+
8
+ set clk_port [get_ports $clk_port_name]
9
+
10
+ create_clock -name $clk_name -period $clk_period $clk_port
11
+ set clk_io_name vclk_$clk_name
12
+ create_clock -name $clk_io_name -period $clk_period
13
+ set_clock_latency 0.700 [get_clocks $clk_name]
14
+ set_clock_latency 0.700 [get_clocks $clk_io_name]
15
+
16
+ set non_clock_inputs [all_inputs -no_clocks]
17
+
18
+ set_input_delay [expr $clk_period * $clk_io_pct] -clock $clk_io_name $non_clock_inputs
19
+ set_output_delay [expr $clk_period * $clk_io_pct] -clock $clk_io_name [all_outputs]
chips/openroad_flow_scripts/flow/designs/sky130hs/riscv32i/config.mk ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export DESIGN_NICKNAME = riscv32i
2
+ export DESIGN_NAME = riscv
3
+ export PLATFORM = sky130hs
4
+
5
+ export VERILOG_FILES = $(sort $(wildcard $(DESIGN_HOME)/src/$(DESIGN_NICKNAME)/*.v))
6
+ export SDC_FILE = $(DESIGN_HOME)/$(PLATFORM)/$(DESIGN_NICKNAME)/constraint.sdc
7
+
8
+ export CORE_UTILIZATION = 60
9
+ export PLACE_DENSITY_LB_ADDON = 0.1
10
+ # many east pins cause global routing congestion
11
+ export PLACE_PINS_ARGS=-min_distance 6 -min_distance_in_tracks
12
+ export TNS_END_PERCENT = 100
13
+ export SETUP_REPAIR_PHASES = PARALLEL_EVAL
14
+
15
+ export FASTROUTE_TCL = $(DESIGN_HOME)/$(PLATFORM)/$(DESIGN_NICKNAME)/fastroute.tcl
16
+
17
+ export SWAP_ARITH_OPERATORS = 1
18
+ export OPENROAD_HIERARCHICAL = 1
19
+
chips/openroad_flow_scripts/flow/designs/sky130hs/riscv32i/constraint.sdc ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ set clk_name clk
2
+ set clk_port_name clk
3
+ set clk_period 4.0
4
+ set clk_io_pct 0.2
5
+
6
+ set clk_port [get_ports $clk_port_name]
7
+
8
+ create_clock -name $clk_name -period $clk_period $clk_port
9
+ set clk_io_name vclk_$clk_name
10
+ create_clock -name $clk_io_name -period $clk_period
11
+ set_clock_latency 0.465 [get_clocks $clk_name]
12
+ set_clock_latency 0.465 [get_clocks $clk_io_name]
13
+
14
+ set non_clock_inputs [list]
15
+ foreach input [all_inputs] {
16
+ if { $clk_port != $input } {
17
+ lappend $non_clock_inputs $input
18
+ }
19
+ }
20
+
21
+ set_input_delay [expr $clk_period * $clk_io_pct] -clock $clk_io_name $non_clock_inputs
22
+ set_output_delay [expr $clk_period * $clk_io_pct] -clock $clk_io_name [all_outputs]
chips/openroad_flow_scripts/flow/designs/sky130hs/riscv32i/fastroute.tcl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ set_global_routing_layer_adjustment $::env(MIN_ROUTING_LAYER)-$::env(MAX_ROUTING_LAYER) 0.20
2
+
3
+ set_routing_layers -signal $::env(MIN_ROUTING_LAYER)-$::env(MAX_ROUTING_LAYER)
chips/openroad_flow_scripts/flow/designs/src/aes/LICENSE ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (C) 2000-2009, ASICs World Services, LTD. , AUTHORS All rights
2
+ reserved. Redistribution and use in source, netlist, binary and silicon forms,
3
+ with or without modification, are permitted provided that the following
4
+ conditions are met:
5
+
6
+ - Redistributions of source code must retain the above copyright notice, this
7
+ list of conditions and the following disclaimer.
8
+
9
+ - Redistributions in binary form must reproduce the above copyright notice, this
10
+ list of conditions and the following disclaimer in the documentation and/or
11
+ other materials provided with the distribution.
12
+
13
+ - Neither the name of ASICS World Services, the Authors and/or the names of its
14
+ contributors may be used to endorse or promote products derived from this
15
+ software without specific prior written permission.
16
+
17
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
chips/openroad_flow_scripts/flow/designs/src/aes/README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Summary
2
+
3
+ Simple AES (Rijndael) IP Core.
4
+
5
+ # Source
6
+
7
+ Downloaded from https://opencores.org/projects/aes_core on 8/8/2019.
8
+
9
+ # Modifications
10
+
11
+ - Added SDC timing constraints.
12
+ - Updated verilog to use standard verilog attributes.
13
+ - Added LICENSE file from [here](http://asics.ws/v6/free-ip-cores).
chips/openroad_flow_scripts/flow/designs/src/aes/aes_cipher_top.v ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /////////////////////////////////////////////////////////////////////
2
+ //// ////
3
+ //// AES Cipher Top Level ////
4
+ //// ////
5
+ //// ////
6
+ //// Author: Rudolf Usselmann ////
7
+ //// rudi@asics.ws ////
8
+ //// ////
9
+ //// ////
10
+ //// Downloaded from: http://www.opencores.org/cores/aes_core/ ////
11
+ //// ////
12
+ /////////////////////////////////////////////////////////////////////
13
+ //// ////
14
+ //// Copyright (C) 2000-2002 Rudolf Usselmann ////
15
+ //// www.asics.ws ////
16
+ //// rudi@asics.ws ////
17
+ //// ////
18
+ //// This source file may be used and distributed without ////
19
+ //// restriction provided that this copyright statement is not ////
20
+ //// removed from the file and that any derivative work contains ////
21
+ //// the original copyright notice and the associated disclaimer.////
22
+ //// ////
23
+ //// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
24
+ //// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
25
+ //// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
26
+ //// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
27
+ //// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
28
+ //// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
29
+ //// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
30
+ //// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
31
+ //// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
32
+ //// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
33
+ //// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
34
+ //// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
35
+ //// POSSIBILITY OF SUCH DAMAGE. ////
36
+ //// ////
37
+ /////////////////////////////////////////////////////////////////////
38
+
39
+ // CVS Log
40
+ //
41
+ // $Id: aes_cipher_top.v,v 1.1.1.1 2002-11-09 11:22:48 rudi Exp $
42
+ //
43
+ // $Date: 2002-11-09 11:22:48 $
44
+ // $Revision: 1.1.1.1 $
45
+ // $Author: rudi $
46
+ // $Locker: $
47
+ // $State: Exp $
48
+ //
49
+ // Change History:
50
+ // $Log: not supported by cvs2svn $
51
+ //
52
+ //
53
+ //
54
+ //
55
+ //
56
+
57
+ `include "timescale.v"
58
+
59
+ module aes_cipher_top(clk, rst, ld, done, key, text_in, text_out );
60
+ input clk, rst;
61
+ input ld;
62
+ output done;
63
+ input [127:0] key;
64
+ input [127:0] text_in;
65
+ output [127:0] text_out;
66
+
67
+ ////////////////////////////////////////////////////////////////////
68
+ //
69
+ // Local Wires
70
+ //
71
+
72
+ wire [31:0] w0, w1, w2, w3;
73
+ reg [127:0] text_in_r;
74
+ reg [127:0] text_out;
75
+ reg [7:0] sa00, sa01, sa02, sa03;
76
+ reg [7:0] sa10, sa11, sa12, sa13;
77
+ reg [7:0] sa20, sa21, sa22, sa23;
78
+ reg [7:0] sa30, sa31, sa32, sa33;
79
+ wire [7:0] sa00_next, sa01_next, sa02_next, sa03_next;
80
+ wire [7:0] sa10_next, sa11_next, sa12_next, sa13_next;
81
+ wire [7:0] sa20_next, sa21_next, sa22_next, sa23_next;
82
+ wire [7:0] sa30_next, sa31_next, sa32_next, sa33_next;
83
+ wire [7:0] sa00_sub, sa01_sub, sa02_sub, sa03_sub;
84
+ wire [7:0] sa10_sub, sa11_sub, sa12_sub, sa13_sub;
85
+ wire [7:0] sa20_sub, sa21_sub, sa22_sub, sa23_sub;
86
+ wire [7:0] sa30_sub, sa31_sub, sa32_sub, sa33_sub;
87
+ wire [7:0] sa00_sr, sa01_sr, sa02_sr, sa03_sr;
88
+ wire [7:0] sa10_sr, sa11_sr, sa12_sr, sa13_sr;
89
+ wire [7:0] sa20_sr, sa21_sr, sa22_sr, sa23_sr;
90
+ wire [7:0] sa30_sr, sa31_sr, sa32_sr, sa33_sr;
91
+ wire [7:0] sa00_mc, sa01_mc, sa02_mc, sa03_mc;
92
+ wire [7:0] sa10_mc, sa11_mc, sa12_mc, sa13_mc;
93
+ wire [7:0] sa20_mc, sa21_mc, sa22_mc, sa23_mc;
94
+ wire [7:0] sa30_mc, sa31_mc, sa32_mc, sa33_mc;
95
+ reg done, ld_r;
96
+ reg [3:0] dcnt;
97
+
98
+ ////////////////////////////////////////////////////////////////////
99
+ //
100
+ // Misc Logic
101
+ //
102
+
103
+ always @(posedge clk)
104
+ if(!rst) dcnt <= #1 4'h0;
105
+ else
106
+ if(ld) dcnt <= #1 4'hb;
107
+ else
108
+ if(|dcnt) dcnt <= #1 dcnt - 4'h1;
109
+
110
+ always @(posedge clk) done <= #1 !(|dcnt[3:1]) & dcnt[0] & !ld;
111
+ always @(posedge clk) if(ld) text_in_r <= #1 text_in;
112
+ always @(posedge clk) ld_r <= #1 ld;
113
+
114
+ ////////////////////////////////////////////////////////////////////
115
+ //
116
+ // Initial Permutation (AddRoundKey)
117
+ //
118
+
119
+ always @(posedge clk) sa33 <= #1 ld_r ? text_in_r[007:000] ^ w3[07:00] : sa33_next;
120
+ always @(posedge clk) sa23 <= #1 ld_r ? text_in_r[015:008] ^ w3[15:08] : sa23_next;
121
+ always @(posedge clk) sa13 <= #1 ld_r ? text_in_r[023:016] ^ w3[23:16] : sa13_next;
122
+ always @(posedge clk) sa03 <= #1 ld_r ? text_in_r[031:024] ^ w3[31:24] : sa03_next;
123
+ always @(posedge clk) sa32 <= #1 ld_r ? text_in_r[039:032] ^ w2[07:00] : sa32_next;
124
+ always @(posedge clk) sa22 <= #1 ld_r ? text_in_r[047:040] ^ w2[15:08] : sa22_next;
125
+ always @(posedge clk) sa12 <= #1 ld_r ? text_in_r[055:048] ^ w2[23:16] : sa12_next;
126
+ always @(posedge clk) sa02 <= #1 ld_r ? text_in_r[063:056] ^ w2[31:24] : sa02_next;
127
+ always @(posedge clk) sa31 <= #1 ld_r ? text_in_r[071:064] ^ w1[07:00] : sa31_next;
128
+ always @(posedge clk) sa21 <= #1 ld_r ? text_in_r[079:072] ^ w1[15:08] : sa21_next;
129
+ always @(posedge clk) sa11 <= #1 ld_r ? text_in_r[087:080] ^ w1[23:16] : sa11_next;
130
+ always @(posedge clk) sa01 <= #1 ld_r ? text_in_r[095:088] ^ w1[31:24] : sa01_next;
131
+ always @(posedge clk) sa30 <= #1 ld_r ? text_in_r[103:096] ^ w0[07:00] : sa30_next;
132
+ always @(posedge clk) sa20 <= #1 ld_r ? text_in_r[111:104] ^ w0[15:08] : sa20_next;
133
+ always @(posedge clk) sa10 <= #1 ld_r ? text_in_r[119:112] ^ w0[23:16] : sa10_next;
134
+ always @(posedge clk) sa00 <= #1 ld_r ? text_in_r[127:120] ^ w0[31:24] : sa00_next;
135
+
136
+ ////////////////////////////////////////////////////////////////////
137
+ //
138
+ // Round Permutations
139
+ //
140
+
141
+ assign sa00_sr = sa00_sub;
142
+ assign sa01_sr = sa01_sub;
143
+ assign sa02_sr = sa02_sub;
144
+ assign sa03_sr = sa03_sub;
145
+ assign sa10_sr = sa11_sub;
146
+ assign sa11_sr = sa12_sub;
147
+ assign sa12_sr = sa13_sub;
148
+ assign sa13_sr = sa10_sub;
149
+ assign sa20_sr = sa22_sub;
150
+ assign sa21_sr = sa23_sub;
151
+ assign sa22_sr = sa20_sub;
152
+ assign sa23_sr = sa21_sub;
153
+ assign sa30_sr = sa33_sub;
154
+ assign sa31_sr = sa30_sub;
155
+ assign sa32_sr = sa31_sub;
156
+ assign sa33_sr = sa32_sub;
157
+ assign {sa00_mc, sa10_mc, sa20_mc, sa30_mc} = mix_col(sa00_sr,sa10_sr,sa20_sr,sa30_sr);
158
+ assign {sa01_mc, sa11_mc, sa21_mc, sa31_mc} = mix_col(sa01_sr,sa11_sr,sa21_sr,sa31_sr);
159
+ assign {sa02_mc, sa12_mc, sa22_mc, sa32_mc} = mix_col(sa02_sr,sa12_sr,sa22_sr,sa32_sr);
160
+ assign {sa03_mc, sa13_mc, sa23_mc, sa33_mc} = mix_col(sa03_sr,sa13_sr,sa23_sr,sa33_sr);
161
+ assign sa00_next = sa00_mc ^ w0[31:24];
162
+ assign sa01_next = sa01_mc ^ w1[31:24];
163
+ assign sa02_next = sa02_mc ^ w2[31:24];
164
+ assign sa03_next = sa03_mc ^ w3[31:24];
165
+ assign sa10_next = sa10_mc ^ w0[23:16];
166
+ assign sa11_next = sa11_mc ^ w1[23:16];
167
+ assign sa12_next = sa12_mc ^ w2[23:16];
168
+ assign sa13_next = sa13_mc ^ w3[23:16];
169
+ assign sa20_next = sa20_mc ^ w0[15:08];
170
+ assign sa21_next = sa21_mc ^ w1[15:08];
171
+ assign sa22_next = sa22_mc ^ w2[15:08];
172
+ assign sa23_next = sa23_mc ^ w3[15:08];
173
+ assign sa30_next = sa30_mc ^ w0[07:00];
174
+ assign sa31_next = sa31_mc ^ w1[07:00];
175
+ assign sa32_next = sa32_mc ^ w2[07:00];
176
+ assign sa33_next = sa33_mc ^ w3[07:00];
177
+
178
+ ////////////////////////////////////////////////////////////////////
179
+ //
180
+ // Final text output
181
+ //
182
+
183
+ always @(posedge clk) text_out[127:120] <= #1 sa00_sr ^ w0[31:24];
184
+ always @(posedge clk) text_out[095:088] <= #1 sa01_sr ^ w1[31:24];
185
+ always @(posedge clk) text_out[063:056] <= #1 sa02_sr ^ w2[31:24];
186
+ always @(posedge clk) text_out[031:024] <= #1 sa03_sr ^ w3[31:24];
187
+ always @(posedge clk) text_out[119:112] <= #1 sa10_sr ^ w0[23:16];
188
+ always @(posedge clk) text_out[087:080] <= #1 sa11_sr ^ w1[23:16];
189
+ always @(posedge clk) text_out[055:048] <= #1 sa12_sr ^ w2[23:16];
190
+ always @(posedge clk) text_out[023:016] <= #1 sa13_sr ^ w3[23:16];
191
+ always @(posedge clk) text_out[111:104] <= #1 sa20_sr ^ w0[15:08];
192
+ always @(posedge clk) text_out[079:072] <= #1 sa21_sr ^ w1[15:08];
193
+ always @(posedge clk) text_out[047:040] <= #1 sa22_sr ^ w2[15:08];
194
+ always @(posedge clk) text_out[015:008] <= #1 sa23_sr ^ w3[15:08];
195
+ always @(posedge clk) text_out[103:096] <= #1 sa30_sr ^ w0[07:00];
196
+ always @(posedge clk) text_out[071:064] <= #1 sa31_sr ^ w1[07:00];
197
+ always @(posedge clk) text_out[039:032] <= #1 sa32_sr ^ w2[07:00];
198
+ always @(posedge clk) text_out[007:000] <= #1 sa33_sr ^ w3[07:00];
199
+
200
+ ////////////////////////////////////////////////////////////////////
201
+ //
202
+ // Generic Functions
203
+ //
204
+
205
+ function [31:0] mix_col;
206
+ input [7:0] s0,s1,s2,s3;
207
+ reg [7:0] s0_o,s1_o,s2_o,s3_o;
208
+ begin
209
+ mix_col[31:24]=xtime(s0)^xtime(s1)^s1^s2^s3;
210
+ mix_col[23:16]=s0^xtime(s1)^xtime(s2)^s2^s3;
211
+ mix_col[15:08]=s0^s1^xtime(s2)^xtime(s3)^s3;
212
+ mix_col[07:00]=xtime(s0)^s0^s1^s2^xtime(s3);
213
+ end
214
+ endfunction
215
+
216
+ function [7:0] xtime;
217
+ input [7:0] b; xtime={b[6:0],1'b0}^(8'h1b&{8{b[7]}});
218
+ endfunction
219
+
220
+ ////////////////////////////////////////////////////////////////////
221
+ //
222
+ // Modules
223
+ //
224
+
225
+ aes_key_expand_128 u0(
226
+ .clk( clk ),
227
+ .kld( ld ),
228
+ .key( key ),
229
+ .wo_0( w0 ),
230
+ .wo_1( w1 ),
231
+ .wo_2( w2 ),
232
+ .wo_3( w3 ));
233
+
234
+ aes_sbox us00( .a( sa00 ), .d( sa00_sub ));
235
+ aes_sbox us01( .a( sa01 ), .d( sa01_sub ));
236
+ aes_sbox us02( .a( sa02 ), .d( sa02_sub ));
237
+ aes_sbox us03( .a( sa03 ), .d( sa03_sub ));
238
+ aes_sbox us10( .a( sa10 ), .d( sa10_sub ));
239
+ aes_sbox us11( .a( sa11 ), .d( sa11_sub ));
240
+ aes_sbox us12( .a( sa12 ), .d( sa12_sub ));
241
+ aes_sbox us13( .a( sa13 ), .d( sa13_sub ));
242
+ aes_sbox us20( .a( sa20 ), .d( sa20_sub ));
243
+ aes_sbox us21( .a( sa21 ), .d( sa21_sub ));
244
+ aes_sbox us22( .a( sa22 ), .d( sa22_sub ));
245
+ aes_sbox us23( .a( sa23 ), .d( sa23_sub ));
246
+ aes_sbox us30( .a( sa30 ), .d( sa30_sub ));
247
+ aes_sbox us31( .a( sa31 ), .d( sa31_sub ));
248
+ aes_sbox us32( .a( sa32 ), .d( sa32_sub ));
249
+ aes_sbox us33( .a( sa33 ), .d( sa33_sub ));
250
+
251
+ endmodule
252
+
253
+
chips/openroad_flow_scripts/flow/designs/src/aes/aes_inv_cipher_top.v ADDED
@@ -0,0 +1,324 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /////////////////////////////////////////////////////////////////////
2
+ //// ////
3
+ //// AES Inverse Cipher Top Level ////
4
+ //// ////
5
+ //// ////
6
+ //// Author: Rudolf Usselmann ////
7
+ //// rudi@asics.ws ////
8
+ //// ////
9
+ //// ////
10
+ //// Downloaded from: http://www.opencores.org/cores/aes_core/ ////
11
+ //// ////
12
+ /////////////////////////////////////////////////////////////////////
13
+ //// ////
14
+ //// Copyright (C) 2000-2002 Rudolf Usselmann ////
15
+ //// www.asics.ws ////
16
+ //// rudi@asics.ws ////
17
+ //// ////
18
+ //// This source file may be used and distributed without ////
19
+ //// restriction provided that this copyright statement is not ////
20
+ //// removed from the file and that any derivative work contains ////
21
+ //// the original copyright notice and the associated disclaimer.////
22
+ //// ////
23
+ //// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
24
+ //// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
25
+ //// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
26
+ //// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
27
+ //// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
28
+ //// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
29
+ //// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
30
+ //// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
31
+ //// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
32
+ //// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
33
+ //// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
34
+ //// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
35
+ //// POSSIBILITY OF SUCH DAMAGE. ////
36
+ //// ////
37
+ /////////////////////////////////////////////////////////////////////
38
+
39
+ // CVS Log
40
+ //
41
+ // $Id: aes_inv_cipher_top.v,v 1.1.1.1 2002-11-09 11:22:53 rudi Exp $
42
+ //
43
+ // $Date: 2002-11-09 11:22:53 $
44
+ // $Revision: 1.1.1.1 $
45
+ // $Author: rudi $
46
+ // $Locker: $
47
+ // $State: Exp $
48
+ //
49
+ // Change History:
50
+ // $Log: not supported by cvs2svn $
51
+ //
52
+ //
53
+ //
54
+ //
55
+ //
56
+
57
+ `include "timescale.v"
58
+
59
+ module aes_inv_cipher_top(clk, rst, kld, ld, done, key, text_in, text_out );
60
+ input clk, rst;
61
+ input kld, ld;
62
+ output done;
63
+ input [127:0] key;
64
+ input [127:0] text_in;
65
+ output [127:0] text_out;
66
+
67
+ ////////////////////////////////////////////////////////////////////
68
+ //
69
+ // Local Wires
70
+ //
71
+
72
+ wire [31:0] wk0, wk1, wk2, wk3;
73
+ reg [31:0] w0, w1, w2, w3;
74
+ reg [127:0] text_in_r;
75
+ reg [127:0] text_out;
76
+ reg [7:0] sa00, sa01, sa02, sa03;
77
+ reg [7:0] sa10, sa11, sa12, sa13;
78
+ reg [7:0] sa20, sa21, sa22, sa23;
79
+ reg [7:0] sa30, sa31, sa32, sa33;
80
+ wire [7:0] sa00_next, sa01_next, sa02_next, sa03_next;
81
+ wire [7:0] sa10_next, sa11_next, sa12_next, sa13_next;
82
+ wire [7:0] sa20_next, sa21_next, sa22_next, sa23_next;
83
+ wire [7:0] sa30_next, sa31_next, sa32_next, sa33_next;
84
+ wire [7:0] sa00_sub, sa01_sub, sa02_sub, sa03_sub;
85
+ wire [7:0] sa10_sub, sa11_sub, sa12_sub, sa13_sub;
86
+ wire [7:0] sa20_sub, sa21_sub, sa22_sub, sa23_sub;
87
+ wire [7:0] sa30_sub, sa31_sub, sa32_sub, sa33_sub;
88
+ wire [7:0] sa00_sr, sa01_sr, sa02_sr, sa03_sr;
89
+ wire [7:0] sa10_sr, sa11_sr, sa12_sr, sa13_sr;
90
+ wire [7:0] sa20_sr, sa21_sr, sa22_sr, sa23_sr;
91
+ wire [7:0] sa30_sr, sa31_sr, sa32_sr, sa33_sr;
92
+ wire [7:0] sa00_ark, sa01_ark, sa02_ark, sa03_ark;
93
+ wire [7:0] sa10_ark, sa11_ark, sa12_ark, sa13_ark;
94
+ wire [7:0] sa20_ark, sa21_ark, sa22_ark, sa23_ark;
95
+ wire [7:0] sa30_ark, sa31_ark, sa32_ark, sa33_ark;
96
+ reg ld_r, go, done;
97
+ reg [3:0] dcnt;
98
+
99
+ ////////////////////////////////////////////////////////////////////
100
+ //
101
+ // Misc Logic
102
+ //
103
+
104
+ always @(posedge clk)
105
+ if(!rst) dcnt <= #1 4'h0;
106
+ else
107
+ if(done) dcnt <= #1 4'h0;
108
+ else
109
+ if(ld) dcnt <= #1 4'h1;
110
+ else
111
+ if(go) dcnt <= #1 dcnt + 4'h1;
112
+
113
+ always @(posedge clk) done <= #1 (dcnt==4'hb) & !ld;
114
+
115
+ always @(posedge clk)
116
+ if(!rst) go <= #1 1'b0;
117
+ else
118
+ if(ld) go <= #1 1'b1;
119
+ else
120
+ if(done) go <= #1 1'b0;
121
+
122
+ always @(posedge clk) if(ld) text_in_r <= #1 text_in;
123
+
124
+ always @(posedge clk) ld_r <= #1 ld;
125
+
126
+ ////////////////////////////////////////////////////////////////////
127
+ //
128
+ // Initial Permutation
129
+ //
130
+
131
+ always @(posedge clk) sa33 <= #1 ld_r ? text_in_r[007:000] ^ w3[07:00] : sa33_next;
132
+ always @(posedge clk) sa23 <= #1 ld_r ? text_in_r[015:008] ^ w3[15:08] : sa23_next;
133
+ always @(posedge clk) sa13 <= #1 ld_r ? text_in_r[023:016] ^ w3[23:16] : sa13_next;
134
+ always @(posedge clk) sa03 <= #1 ld_r ? text_in_r[031:024] ^ w3[31:24] : sa03_next;
135
+ always @(posedge clk) sa32 <= #1 ld_r ? text_in_r[039:032] ^ w2[07:00] : sa32_next;
136
+ always @(posedge clk) sa22 <= #1 ld_r ? text_in_r[047:040] ^ w2[15:08] : sa22_next;
137
+ always @(posedge clk) sa12 <= #1 ld_r ? text_in_r[055:048] ^ w2[23:16] : sa12_next;
138
+ always @(posedge clk) sa02 <= #1 ld_r ? text_in_r[063:056] ^ w2[31:24] : sa02_next;
139
+ always @(posedge clk) sa31 <= #1 ld_r ? text_in_r[071:064] ^ w1[07:00] : sa31_next;
140
+ always @(posedge clk) sa21 <= #1 ld_r ? text_in_r[079:072] ^ w1[15:08] : sa21_next;
141
+ always @(posedge clk) sa11 <= #1 ld_r ? text_in_r[087:080] ^ w1[23:16] : sa11_next;
142
+ always @(posedge clk) sa01 <= #1 ld_r ? text_in_r[095:088] ^ w1[31:24] : sa01_next;
143
+ always @(posedge clk) sa30 <= #1 ld_r ? text_in_r[103:096] ^ w0[07:00] : sa30_next;
144
+ always @(posedge clk) sa20 <= #1 ld_r ? text_in_r[111:104] ^ w0[15:08] : sa20_next;
145
+ always @(posedge clk) sa10 <= #1 ld_r ? text_in_r[119:112] ^ w0[23:16] : sa10_next;
146
+ always @(posedge clk) sa00 <= #1 ld_r ? text_in_r[127:120] ^ w0[31:24] : sa00_next;
147
+
148
+ ////////////////////////////////////////////////////////////////////
149
+ //
150
+ // Round Permutations
151
+ //
152
+
153
+ assign sa00_sr = sa00;
154
+ assign sa01_sr = sa01;
155
+ assign sa02_sr = sa02;
156
+ assign sa03_sr = sa03;
157
+ assign sa10_sr = sa13;
158
+ assign sa11_sr = sa10;
159
+ assign sa12_sr = sa11;
160
+ assign sa13_sr = sa12;
161
+ assign sa20_sr = sa22;
162
+ assign sa21_sr = sa23;
163
+ assign sa22_sr = sa20;
164
+ assign sa23_sr = sa21;
165
+ assign sa30_sr = sa31;
166
+ assign sa31_sr = sa32;
167
+ assign sa32_sr = sa33;
168
+ assign sa33_sr = sa30;
169
+ assign sa00_ark = sa00_sub ^ w0[31:24];
170
+ assign sa01_ark = sa01_sub ^ w1[31:24];
171
+ assign sa02_ark = sa02_sub ^ w2[31:24];
172
+ assign sa03_ark = sa03_sub ^ w3[31:24];
173
+ assign sa10_ark = sa10_sub ^ w0[23:16];
174
+ assign sa11_ark = sa11_sub ^ w1[23:16];
175
+ assign sa12_ark = sa12_sub ^ w2[23:16];
176
+ assign sa13_ark = sa13_sub ^ w3[23:16];
177
+ assign sa20_ark = sa20_sub ^ w0[15:08];
178
+ assign sa21_ark = sa21_sub ^ w1[15:08];
179
+ assign sa22_ark = sa22_sub ^ w2[15:08];
180
+ assign sa23_ark = sa23_sub ^ w3[15:08];
181
+ assign sa30_ark = sa30_sub ^ w0[07:00];
182
+ assign sa31_ark = sa31_sub ^ w1[07:00];
183
+ assign sa32_ark = sa32_sub ^ w2[07:00];
184
+ assign sa33_ark = sa33_sub ^ w3[07:00];
185
+ assign {sa00_next, sa10_next, sa20_next, sa30_next} = inv_mix_col(sa00_ark,sa10_ark,sa20_ark,sa30_ark);
186
+ assign {sa01_next, sa11_next, sa21_next, sa31_next} = inv_mix_col(sa01_ark,sa11_ark,sa21_ark,sa31_ark);
187
+ assign {sa02_next, sa12_next, sa22_next, sa32_next} = inv_mix_col(sa02_ark,sa12_ark,sa22_ark,sa32_ark);
188
+ assign {sa03_next, sa13_next, sa23_next, sa33_next} = inv_mix_col(sa03_ark,sa13_ark,sa23_ark,sa33_ark);
189
+
190
+ ////////////////////////////////////////////////////////////////////
191
+ //
192
+ // Final Text Output
193
+ //
194
+
195
+ always @(posedge clk) text_out[127:120] <= #1 sa00_ark;
196
+ always @(posedge clk) text_out[095:088] <= #1 sa01_ark;
197
+ always @(posedge clk) text_out[063:056] <= #1 sa02_ark;
198
+ always @(posedge clk) text_out[031:024] <= #1 sa03_ark;
199
+ always @(posedge clk) text_out[119:112] <= #1 sa10_ark;
200
+ always @(posedge clk) text_out[087:080] <= #1 sa11_ark;
201
+ always @(posedge clk) text_out[055:048] <= #1 sa12_ark;
202
+ always @(posedge clk) text_out[023:016] <= #1 sa13_ark;
203
+ always @(posedge clk) text_out[111:104] <= #1 sa20_ark;
204
+ always @(posedge clk) text_out[079:072] <= #1 sa21_ark;
205
+ always @(posedge clk) text_out[047:040] <= #1 sa22_ark;
206
+ always @(posedge clk) text_out[015:008] <= #1 sa23_ark;
207
+ always @(posedge clk) text_out[103:096] <= #1 sa30_ark;
208
+ always @(posedge clk) text_out[071:064] <= #1 sa31_ark;
209
+ always @(posedge clk) text_out[039:032] <= #1 sa32_ark;
210
+ always @(posedge clk) text_out[007:000] <= #1 sa33_ark;
211
+
212
+ ////////////////////////////////////////////////////////////////////
213
+ //
214
+ // Generic Functions
215
+ //
216
+
217
+ function [31:0] inv_mix_col;
218
+ input [7:0] s0,s1,s2,s3;
219
+ begin
220
+ inv_mix_col[31:24]=pmul_e(s0)^pmul_b(s1)^pmul_d(s2)^pmul_9(s3);
221
+ inv_mix_col[23:16]=pmul_9(s0)^pmul_e(s1)^pmul_b(s2)^pmul_d(s3);
222
+ inv_mix_col[15:08]=pmul_d(s0)^pmul_9(s1)^pmul_e(s2)^pmul_b(s3);
223
+ inv_mix_col[07:00]=pmul_b(s0)^pmul_d(s1)^pmul_9(s2)^pmul_e(s3);
224
+ end
225
+ endfunction
226
+
227
+ // Some synthesis tools don't like xtime being called recursevly ...
228
+ function [7:0] pmul_e;
229
+ input [7:0] b;
230
+ reg [7:0] two,four,eight;
231
+ begin
232
+ two=xtime(b);four=xtime(two);eight=xtime(four);pmul_e=eight^four^two;
233
+ end
234
+ endfunction
235
+
236
+ function [7:0] pmul_9;
237
+ input [7:0] b;
238
+ reg [7:0] two,four,eight;
239
+ begin
240
+ two=xtime(b);four=xtime(two);eight=xtime(four);pmul_9=eight^b;
241
+ end
242
+ endfunction
243
+
244
+ function [7:0] pmul_d;
245
+ input [7:0] b;
246
+ reg [7:0] two,four,eight;
247
+ begin
248
+ two=xtime(b);four=xtime(two);eight=xtime(four);pmul_d=eight^four^b;
249
+ end
250
+ endfunction
251
+
252
+ function [7:0] pmul_b;
253
+ input [7:0] b;
254
+ reg [7:0] two,four,eight;
255
+ begin
256
+ two=xtime(b);four=xtime(two);eight=xtime(four);pmul_b=eight^two^b;
257
+ end
258
+ endfunction
259
+
260
+ function [7:0] xtime;
261
+ input [7:0] b;xtime={b[6:0],1'b0}^(8'h1b&{8{b[7]}});
262
+ endfunction
263
+
264
+ ////////////////////////////////////////////////////////////////////
265
+ //
266
+ // Key Buffer
267
+ //
268
+
269
+ reg [127:0] kb[10:0];
270
+ reg [3:0] kcnt;
271
+ reg kdone;
272
+ reg kb_ld;
273
+
274
+ always @(posedge clk)
275
+ if(!rst) kcnt <= #1 4'ha;
276
+ else
277
+ if(kld) kcnt <= #1 4'ha;
278
+ else
279
+ if(kb_ld) kcnt <= #1 kcnt - 4'h1;
280
+
281
+ always @(posedge clk)
282
+ if(!rst) kb_ld <= #1 1'b0;
283
+ else
284
+ if(kld) kb_ld <= #1 1'b1;
285
+ else
286
+ if(kcnt==4'h0) kb_ld <= #1 1'b0;
287
+
288
+ always @(posedge clk) kdone <= #1 (kcnt==4'h0) & !kld;
289
+ always @(posedge clk) if(kb_ld) kb[kcnt] <= #1 {wk3, wk2, wk1, wk0};
290
+ always @(posedge clk) {w3, w2, w1, w0} <= #1 kb[dcnt];
291
+
292
+ ////////////////////////////////////////////////////////////////////
293
+ //
294
+ // Modules
295
+ //
296
+
297
+ aes_key_expand_128 u0(
298
+ .clk( clk ),
299
+ .kld( kld ),
300
+ .key( key ),
301
+ .wo_0( wk0 ),
302
+ .wo_1( wk1 ),
303
+ .wo_2( wk2 ),
304
+ .wo_3( wk3 ));
305
+
306
+ aes_inv_sbox us00( .a( sa00_sr ), .d( sa00_sub ));
307
+ aes_inv_sbox us01( .a( sa01_sr ), .d( sa01_sub ));
308
+ aes_inv_sbox us02( .a( sa02_sr ), .d( sa02_sub ));
309
+ aes_inv_sbox us03( .a( sa03_sr ), .d( sa03_sub ));
310
+ aes_inv_sbox us10( .a( sa10_sr ), .d( sa10_sub ));
311
+ aes_inv_sbox us11( .a( sa11_sr ), .d( sa11_sub ));
312
+ aes_inv_sbox us12( .a( sa12_sr ), .d( sa12_sub ));
313
+ aes_inv_sbox us13( .a( sa13_sr ), .d( sa13_sub ));
314
+ aes_inv_sbox us20( .a( sa20_sr ), .d( sa20_sub ));
315
+ aes_inv_sbox us21( .a( sa21_sr ), .d( sa21_sub ));
316
+ aes_inv_sbox us22( .a( sa22_sr ), .d( sa22_sub ));
317
+ aes_inv_sbox us23( .a( sa23_sr ), .d( sa23_sub ));
318
+ aes_inv_sbox us30( .a( sa30_sr ), .d( sa30_sub ));
319
+ aes_inv_sbox us31( .a( sa31_sr ), .d( sa31_sub ));
320
+ aes_inv_sbox us32( .a( sa32_sr ), .d( sa32_sub ));
321
+ aes_inv_sbox us33( .a( sa33_sr ), .d( sa33_sub ));
322
+
323
+ endmodule
324
+
chips/openroad_flow_scripts/flow/designs/src/aes/aes_inv_sbox.v ADDED
@@ -0,0 +1,325 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /////////////////////////////////////////////////////////////////////
2
+ //// ////
3
+ //// AES Inverse SBOX (ROM) ////
4
+ //// ////
5
+ //// ////
6
+ //// Author: Rudolf Usselmann ////
7
+ //// rudi@asics.ws ////
8
+ //// ////
9
+ //// ////
10
+ //// Downloaded from: http://www.opencores.org/cores/aes_core/ ////
11
+ //// ////
12
+ /////////////////////////////////////////////////////////////////////
13
+ //// ////
14
+ //// Copyright (C) 2000-2002 Rudolf Usselmann ////
15
+ //// www.asics.ws ////
16
+ //// rudi@asics.ws ////
17
+ //// ////
18
+ //// This source file may be used and distributed without ////
19
+ //// restriction provided that this copyright statement is not ////
20
+ //// removed from the file and that any derivative work contains ////
21
+ //// the original copyright notice and the associated disclaimer.////
22
+ //// ////
23
+ //// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
24
+ //// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
25
+ //// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
26
+ //// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
27
+ //// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
28
+ //// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
29
+ //// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
30
+ //// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
31
+ //// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
32
+ //// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
33
+ //// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
34
+ //// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
35
+ //// POSSIBILITY OF SUCH DAMAGE. ////
36
+ //// ////
37
+ /////////////////////////////////////////////////////////////////////
38
+
39
+ // CVS Log
40
+ //
41
+ // $Id: aes_inv_sbox.v,v 1.1.1.1 2002-11-09 11:22:55 rudi Exp $
42
+ //
43
+ // $Date: 2002-11-09 11:22:55 $
44
+ // $Revision: 1.1.1.1 $
45
+ // $Author: rudi $
46
+ // $Locker: $
47
+ // $State: Exp $
48
+ //
49
+ // Change History:
50
+ // $Log: not supported by cvs2svn $
51
+ //
52
+ //
53
+ //
54
+ //
55
+ //
56
+
57
+ `include "timescale.v"
58
+
59
+ module aes_inv_sbox(a,d);
60
+ input [7:0] a;
61
+ output [7:0] d;
62
+ reg [7:0] d;
63
+
64
+ always @(a)
65
+ (* full_case, parallel_case *) case(a)
66
+ 8'h00: d=8'h52;
67
+ 8'h01: d=8'h09;
68
+ 8'h02: d=8'h6a;
69
+ 8'h03: d=8'hd5;
70
+ 8'h04: d=8'h30;
71
+ 8'h05: d=8'h36;
72
+ 8'h06: d=8'ha5;
73
+ 8'h07: d=8'h38;
74
+ 8'h08: d=8'hbf;
75
+ 8'h09: d=8'h40;
76
+ 8'h0a: d=8'ha3;
77
+ 8'h0b: d=8'h9e;
78
+ 8'h0c: d=8'h81;
79
+ 8'h0d: d=8'hf3;
80
+ 8'h0e: d=8'hd7;
81
+ 8'h0f: d=8'hfb;
82
+ 8'h10: d=8'h7c;
83
+ 8'h11: d=8'he3;
84
+ 8'h12: d=8'h39;
85
+ 8'h13: d=8'h82;
86
+ 8'h14: d=8'h9b;
87
+ 8'h15: d=8'h2f;
88
+ 8'h16: d=8'hff;
89
+ 8'h17: d=8'h87;
90
+ 8'h18: d=8'h34;
91
+ 8'h19: d=8'h8e;
92
+ 8'h1a: d=8'h43;
93
+ 8'h1b: d=8'h44;
94
+ 8'h1c: d=8'hc4;
95
+ 8'h1d: d=8'hde;
96
+ 8'h1e: d=8'he9;
97
+ 8'h1f: d=8'hcb;
98
+ 8'h20: d=8'h54;
99
+ 8'h21: d=8'h7b;
100
+ 8'h22: d=8'h94;
101
+ 8'h23: d=8'h32;
102
+ 8'h24: d=8'ha6;
103
+ 8'h25: d=8'hc2;
104
+ 8'h26: d=8'h23;
105
+ 8'h27: d=8'h3d;
106
+ 8'h28: d=8'hee;
107
+ 8'h29: d=8'h4c;
108
+ 8'h2a: d=8'h95;
109
+ 8'h2b: d=8'h0b;
110
+ 8'h2c: d=8'h42;
111
+ 8'h2d: d=8'hfa;
112
+ 8'h2e: d=8'hc3;
113
+ 8'h2f: d=8'h4e;
114
+ 8'h30: d=8'h08;
115
+ 8'h31: d=8'h2e;
116
+ 8'h32: d=8'ha1;
117
+ 8'h33: d=8'h66;
118
+ 8'h34: d=8'h28;
119
+ 8'h35: d=8'hd9;
120
+ 8'h36: d=8'h24;
121
+ 8'h37: d=8'hb2;
122
+ 8'h38: d=8'h76;
123
+ 8'h39: d=8'h5b;
124
+ 8'h3a: d=8'ha2;
125
+ 8'h3b: d=8'h49;
126
+ 8'h3c: d=8'h6d;
127
+ 8'h3d: d=8'h8b;
128
+ 8'h3e: d=8'hd1;
129
+ 8'h3f: d=8'h25;
130
+ 8'h40: d=8'h72;
131
+ 8'h41: d=8'hf8;
132
+ 8'h42: d=8'hf6;
133
+ 8'h43: d=8'h64;
134
+ 8'h44: d=8'h86;
135
+ 8'h45: d=8'h68;
136
+ 8'h46: d=8'h98;
137
+ 8'h47: d=8'h16;
138
+ 8'h48: d=8'hd4;
139
+ 8'h49: d=8'ha4;
140
+ 8'h4a: d=8'h5c;
141
+ 8'h4b: d=8'hcc;
142
+ 8'h4c: d=8'h5d;
143
+ 8'h4d: d=8'h65;
144
+ 8'h4e: d=8'hb6;
145
+ 8'h4f: d=8'h92;
146
+ 8'h50: d=8'h6c;
147
+ 8'h51: d=8'h70;
148
+ 8'h52: d=8'h48;
149
+ 8'h53: d=8'h50;
150
+ 8'h54: d=8'hfd;
151
+ 8'h55: d=8'hed;
152
+ 8'h56: d=8'hb9;
153
+ 8'h57: d=8'hda;
154
+ 8'h58: d=8'h5e;
155
+ 8'h59: d=8'h15;
156
+ 8'h5a: d=8'h46;
157
+ 8'h5b: d=8'h57;
158
+ 8'h5c: d=8'ha7;
159
+ 8'h5d: d=8'h8d;
160
+ 8'h5e: d=8'h9d;
161
+ 8'h5f: d=8'h84;
162
+ 8'h60: d=8'h90;
163
+ 8'h61: d=8'hd8;
164
+ 8'h62: d=8'hab;
165
+ 8'h63: d=8'h00;
166
+ 8'h64: d=8'h8c;
167
+ 8'h65: d=8'hbc;
168
+ 8'h66: d=8'hd3;
169
+ 8'h67: d=8'h0a;
170
+ 8'h68: d=8'hf7;
171
+ 8'h69: d=8'he4;
172
+ 8'h6a: d=8'h58;
173
+ 8'h6b: d=8'h05;
174
+ 8'h6c: d=8'hb8;
175
+ 8'h6d: d=8'hb3;
176
+ 8'h6e: d=8'h45;
177
+ 8'h6f: d=8'h06;
178
+ 8'h70: d=8'hd0;
179
+ 8'h71: d=8'h2c;
180
+ 8'h72: d=8'h1e;
181
+ 8'h73: d=8'h8f;
182
+ 8'h74: d=8'hca;
183
+ 8'h75: d=8'h3f;
184
+ 8'h76: d=8'h0f;
185
+ 8'h77: d=8'h02;
186
+ 8'h78: d=8'hc1;
187
+ 8'h79: d=8'haf;
188
+ 8'h7a: d=8'hbd;
189
+ 8'h7b: d=8'h03;
190
+ 8'h7c: d=8'h01;
191
+ 8'h7d: d=8'h13;
192
+ 8'h7e: d=8'h8a;
193
+ 8'h7f: d=8'h6b;
194
+ 8'h80: d=8'h3a;
195
+ 8'h81: d=8'h91;
196
+ 8'h82: d=8'h11;
197
+ 8'h83: d=8'h41;
198
+ 8'h84: d=8'h4f;
199
+ 8'h85: d=8'h67;
200
+ 8'h86: d=8'hdc;
201
+ 8'h87: d=8'hea;
202
+ 8'h88: d=8'h97;
203
+ 8'h89: d=8'hf2;
204
+ 8'h8a: d=8'hcf;
205
+ 8'h8b: d=8'hce;
206
+ 8'h8c: d=8'hf0;
207
+ 8'h8d: d=8'hb4;
208
+ 8'h8e: d=8'he6;
209
+ 8'h8f: d=8'h73;
210
+ 8'h90: d=8'h96;
211
+ 8'h91: d=8'hac;
212
+ 8'h92: d=8'h74;
213
+ 8'h93: d=8'h22;
214
+ 8'h94: d=8'he7;
215
+ 8'h95: d=8'had;
216
+ 8'h96: d=8'h35;
217
+ 8'h97: d=8'h85;
218
+ 8'h98: d=8'he2;
219
+ 8'h99: d=8'hf9;
220
+ 8'h9a: d=8'h37;
221
+ 8'h9b: d=8'he8;
222
+ 8'h9c: d=8'h1c;
223
+ 8'h9d: d=8'h75;
224
+ 8'h9e: d=8'hdf;
225
+ 8'h9f: d=8'h6e;
226
+ 8'ha0: d=8'h47;
227
+ 8'ha1: d=8'hf1;
228
+ 8'ha2: d=8'h1a;
229
+ 8'ha3: d=8'h71;
230
+ 8'ha4: d=8'h1d;
231
+ 8'ha5: d=8'h29;
232
+ 8'ha6: d=8'hc5;
233
+ 8'ha7: d=8'h89;
234
+ 8'ha8: d=8'h6f;
235
+ 8'ha9: d=8'hb7;
236
+ 8'haa: d=8'h62;
237
+ 8'hab: d=8'h0e;
238
+ 8'hac: d=8'haa;
239
+ 8'had: d=8'h18;
240
+ 8'hae: d=8'hbe;
241
+ 8'haf: d=8'h1b;
242
+ 8'hb0: d=8'hfc;
243
+ 8'hb1: d=8'h56;
244
+ 8'hb2: d=8'h3e;
245
+ 8'hb3: d=8'h4b;
246
+ 8'hb4: d=8'hc6;
247
+ 8'hb5: d=8'hd2;
248
+ 8'hb6: d=8'h79;
249
+ 8'hb7: d=8'h20;
250
+ 8'hb8: d=8'h9a;
251
+ 8'hb9: d=8'hdb;
252
+ 8'hba: d=8'hc0;
253
+ 8'hbb: d=8'hfe;
254
+ 8'hbc: d=8'h78;
255
+ 8'hbd: d=8'hcd;
256
+ 8'hbe: d=8'h5a;
257
+ 8'hbf: d=8'hf4;
258
+ 8'hc0: d=8'h1f;
259
+ 8'hc1: d=8'hdd;
260
+ 8'hc2: d=8'ha8;
261
+ 8'hc3: d=8'h33;
262
+ 8'hc4: d=8'h88;
263
+ 8'hc5: d=8'h07;
264
+ 8'hc6: d=8'hc7;
265
+ 8'hc7: d=8'h31;
266
+ 8'hc8: d=8'hb1;
267
+ 8'hc9: d=8'h12;
268
+ 8'hca: d=8'h10;
269
+ 8'hcb: d=8'h59;
270
+ 8'hcc: d=8'h27;
271
+ 8'hcd: d=8'h80;
272
+ 8'hce: d=8'hec;
273
+ 8'hcf: d=8'h5f;
274
+ 8'hd0: d=8'h60;
275
+ 8'hd1: d=8'h51;
276
+ 8'hd2: d=8'h7f;
277
+ 8'hd3: d=8'ha9;
278
+ 8'hd4: d=8'h19;
279
+ 8'hd5: d=8'hb5;
280
+ 8'hd6: d=8'h4a;
281
+ 8'hd7: d=8'h0d;
282
+ 8'hd8: d=8'h2d;
283
+ 8'hd9: d=8'he5;
284
+ 8'hda: d=8'h7a;
285
+ 8'hdb: d=8'h9f;
286
+ 8'hdc: d=8'h93;
287
+ 8'hdd: d=8'hc9;
288
+ 8'hde: d=8'h9c;
289
+ 8'hdf: d=8'hef;
290
+ 8'he0: d=8'ha0;
291
+ 8'he1: d=8'he0;
292
+ 8'he2: d=8'h3b;
293
+ 8'he3: d=8'h4d;
294
+ 8'he4: d=8'hae;
295
+ 8'he5: d=8'h2a;
296
+ 8'he6: d=8'hf5;
297
+ 8'he7: d=8'hb0;
298
+ 8'he8: d=8'hc8;
299
+ 8'he9: d=8'heb;
300
+ 8'hea: d=8'hbb;
301
+ 8'heb: d=8'h3c;
302
+ 8'hec: d=8'h83;
303
+ 8'hed: d=8'h53;
304
+ 8'hee: d=8'h99;
305
+ 8'hef: d=8'h61;
306
+ 8'hf0: d=8'h17;
307
+ 8'hf1: d=8'h2b;
308
+ 8'hf2: d=8'h04;
309
+ 8'hf3: d=8'h7e;
310
+ 8'hf4: d=8'hba;
311
+ 8'hf5: d=8'h77;
312
+ 8'hf6: d=8'hd6;
313
+ 8'hf7: d=8'h26;
314
+ 8'hf8: d=8'he1;
315
+ 8'hf9: d=8'h69;
316
+ 8'hfa: d=8'h14;
317
+ 8'hfb: d=8'h63;
318
+ 8'hfc: d=8'h55;
319
+ 8'hfd: d=8'h21;
320
+ 8'hfe: d=8'h0c;
321
+ 8'hff: d=8'h7d;
322
+ endcase
323
+ endmodule
324
+
325
+
chips/openroad_flow_scripts/flow/designs/src/aes/aes_key_expand_128.v ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /////////////////////////////////////////////////////////////////////
2
+ //// ////
3
+ //// AES Key Expand Block (for 128 bit keys) ////
4
+ //// ////
5
+ //// ////
6
+ //// Author: Rudolf Usselmann ////
7
+ //// rudi@asics.ws ////
8
+ //// ////
9
+ //// ////
10
+ //// Downloaded from: http://www.opencores.org/cores/aes_core/ ////
11
+ //// ////
12
+ /////////////////////////////////////////////////////////////////////
13
+ //// ////
14
+ //// Copyright (C) 2000-2002 Rudolf Usselmann ////
15
+ //// www.asics.ws ////
16
+ //// rudi@asics.ws ////
17
+ //// ////
18
+ //// This source file may be used and distributed without ////
19
+ //// restriction provided that this copyright statement is not ////
20
+ //// removed from the file and that any derivative work contains ////
21
+ //// the original copyright notice and the associated disclaimer.////
22
+ //// ////
23
+ //// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
24
+ //// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
25
+ //// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
26
+ //// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
27
+ //// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
28
+ //// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
29
+ //// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
30
+ //// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
31
+ //// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
32
+ //// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
33
+ //// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
34
+ //// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
35
+ //// POSSIBILITY OF SUCH DAMAGE. ////
36
+ //// ////
37
+ /////////////////////////////////////////////////////////////////////
38
+
39
+ // CVS Log
40
+ //
41
+ // $Id: aes_key_expand_128.v,v 1.1.1.1 2002-11-09 11:22:38 rudi Exp $
42
+ //
43
+ // $Date: 2002-11-09 11:22:38 $
44
+ // $Revision: 1.1.1.1 $
45
+ // $Author: rudi $
46
+ // $Locker: $
47
+ // $State: Exp $
48
+ //
49
+ // Change History:
50
+ // $Log: not supported by cvs2svn $
51
+ //
52
+ //
53
+ //
54
+ //
55
+ //
56
+
57
+ `include "timescale.v"
58
+
59
+ module aes_key_expand_128(clk, kld, key, wo_0, wo_1, wo_2, wo_3);
60
+ input clk;
61
+ input kld;
62
+ input [127:0] key;
63
+ output [31:0] wo_0, wo_1, wo_2, wo_3;
64
+ reg [31:0] w[3:0];
65
+ wire [31:0] tmp_w;
66
+ wire [31:0] subword;
67
+ wire [31:0] rcon;
68
+
69
+ assign wo_0 = w[0];
70
+ assign wo_1 = w[1];
71
+ assign wo_2 = w[2];
72
+ assign wo_3 = w[3];
73
+ always @(posedge clk) w[0] <= #1 kld ? key[127:096] : w[0]^subword^rcon;
74
+ always @(posedge clk) w[1] <= #1 kld ? key[095:064] : w[0]^w[1]^subword^rcon;
75
+ always @(posedge clk) w[2] <= #1 kld ? key[063:032] : w[0]^w[2]^w[1]^subword^rcon;
76
+ always @(posedge clk) w[3] <= #1 kld ? key[031:000] : w[0]^w[3]^w[2]^w[1]^subword^rcon;
77
+ assign tmp_w = w[3];
78
+ aes_sbox u0( .a(tmp_w[23:16]), .d(subword[31:24]));
79
+ aes_sbox u1( .a(tmp_w[15:08]), .d(subword[23:16]));
80
+ aes_sbox u2( .a(tmp_w[07:00]), .d(subword[15:08]));
81
+ aes_sbox u3( .a(tmp_w[31:24]), .d(subword[07:00]));
82
+ aes_rcon r0( .clk(clk), .kld(kld), .out(rcon));
83
+ endmodule
84
+
chips/openroad_flow_scripts/flow/designs/src/aes/aes_rcon.v ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /////////////////////////////////////////////////////////////////////
2
+ //// ////
3
+ //// AES RCON Block ////
4
+ //// ////
5
+ //// ////
6
+ //// Author: Rudolf Usselmann ////
7
+ //// rudi@asics.ws ////
8
+ //// ////
9
+ //// ////
10
+ //// Downloaded from: http://www.opencores.org/cores/aes_core/ ////
11
+ //// ////
12
+ /////////////////////////////////////////////////////////////////////
13
+ //// ////
14
+ //// Copyright (C) 2000-2002 Rudolf Usselmann ////
15
+ //// www.asics.ws ////
16
+ //// rudi@asics.ws ////
17
+ //// ////
18
+ //// This source file may be used and distributed without ////
19
+ //// restriction provided that this copyright statement is not ////
20
+ //// removed from the file and that any derivative work contains ////
21
+ //// the original copyright notice and the associated disclaimer.////
22
+ //// ////
23
+ //// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
24
+ //// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
25
+ //// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
26
+ //// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
27
+ //// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
28
+ //// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
29
+ //// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
30
+ //// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
31
+ //// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
32
+ //// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
33
+ //// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
34
+ //// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
35
+ //// POSSIBILITY OF SUCH DAMAGE. ////
36
+ //// ////
37
+ /////////////////////////////////////////////////////////////////////
38
+
39
+ // CVS Log
40
+ //
41
+ // $Id: aes_rcon.v,v 1.1.1.1 2002-11-09 11:22:38 rudi Exp $
42
+ //
43
+ // $Date: 2002-11-09 11:22:38 $
44
+ // $Revision: 1.1.1.1 $
45
+ // $Author: rudi $
46
+ // $Locker: $
47
+ // $State: Exp $
48
+ //
49
+ // Change History:
50
+ // $Log: not supported by cvs2svn $
51
+ //
52
+ //
53
+ //
54
+ //
55
+ //
56
+
57
+ `include "timescale.v"
58
+
59
+ module aes_rcon(clk, kld, out);
60
+ input clk;
61
+ input kld;
62
+ output [31:0] out;
63
+ reg [31:0] out;
64
+ reg [3:0] rcnt;
65
+ wire [3:0] rcnt_next;
66
+
67
+ always @(posedge clk)
68
+ if(kld) out <= #1 32'h01_00_00_00;
69
+ else out <= #1 frcon(rcnt_next);
70
+
71
+ assign rcnt_next = rcnt + 4'h1;
72
+ always @(posedge clk)
73
+ if(kld) rcnt <= #1 4'h0;
74
+ else rcnt <= #1 rcnt_next;
75
+
76
+ function [31:0] frcon;
77
+ input [3:0] i;
78
+ (* parallel_case *) case(i)
79
+ 4'h0: frcon=32'h01_00_00_00;
80
+ 4'h1: frcon=32'h02_00_00_00;
81
+ 4'h2: frcon=32'h04_00_00_00;
82
+ 4'h3: frcon=32'h08_00_00_00;
83
+ 4'h4: frcon=32'h10_00_00_00;
84
+ 4'h5: frcon=32'h20_00_00_00;
85
+ 4'h6: frcon=32'h40_00_00_00;
86
+ 4'h7: frcon=32'h80_00_00_00;
87
+ 4'h8: frcon=32'h1b_00_00_00;
88
+ 4'h9: frcon=32'h36_00_00_00;
89
+ default: frcon=32'h00_00_00_00;
90
+ endcase
91
+ endfunction
92
+
93
+ endmodule
chips/openroad_flow_scripts/flow/designs/src/aes/aes_sbox.v ADDED
@@ -0,0 +1,326 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /////////////////////////////////////////////////////////////////////
2
+ //// ////
3
+ //// AES SBOX (ROM) ////
4
+ //// ////
5
+ //// ////
6
+ //// Author: Rudolf Usselmann ////
7
+ //// rudi@asics.ws ////
8
+ //// ////
9
+ //// ////
10
+ //// Downloaded from: http://www.opencores.org/cores/aes_core/ ////
11
+ //// ////
12
+ /////////////////////////////////////////////////////////////////////
13
+ //// ////
14
+ //// Copyright (C) 2000-2002 Rudolf Usselmann ////
15
+ //// www.asics.ws ////
16
+ //// rudi@asics.ws ////
17
+ //// ////
18
+ //// This source file may be used and distributed without ////
19
+ //// restriction provided that this copyright statement is not ////
20
+ //// removed from the file and that any derivative work contains ////
21
+ //// the original copyright notice and the associated disclaimer.////
22
+ //// ////
23
+ //// THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY ////
24
+ //// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED ////
25
+ //// TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS ////
26
+ //// FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR ////
27
+ //// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, ////
28
+ //// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ////
29
+ //// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE ////
30
+ //// GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ////
31
+ //// BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF ////
32
+ //// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ////
33
+ //// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ////
34
+ //// OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ////
35
+ //// POSSIBILITY OF SUCH DAMAGE. ////
36
+ //// ////
37
+ /////////////////////////////////////////////////////////////////////
38
+
39
+ // CVS Log
40
+ //
41
+ // $Id: aes_sbox.v,v 1.1.1.1 2002-11-09 11:22:38 rudi Exp $
42
+ //
43
+ // $Date: 2002-11-09 11:22:38 $
44
+ // $Revision: 1.1.1.1 $
45
+ // $Author: rudi $
46
+ // $Locker: $
47
+ // $State: Exp $
48
+ //
49
+ // Change History:
50
+ // $Log: not supported by cvs2svn $
51
+ //
52
+ //
53
+ //
54
+ //
55
+ //
56
+
57
+ `include "timescale.v"
58
+
59
+ module aes_sbox(a,d);
60
+ input [7:0] a;
61
+ output [7:0] d;
62
+ reg [7:0] d;
63
+
64
+ always @(a)
65
+ (* full_case, parallel_case *) case(a)
66
+ 8'h00: d=8'h63;
67
+ 8'h01: d=8'h7c;
68
+ 8'h02: d=8'h77;
69
+ 8'h03: d=8'h7b;
70
+ 8'h04: d=8'hf2;
71
+ 8'h05: d=8'h6b;
72
+ 8'h06: d=8'h6f;
73
+ 8'h07: d=8'hc5;
74
+ 8'h08: d=8'h30;
75
+ 8'h09: d=8'h01;
76
+ 8'h0a: d=8'h67;
77
+ 8'h0b: d=8'h2b;
78
+ 8'h0c: d=8'hfe;
79
+ 8'h0d: d=8'hd7;
80
+ 8'h0e: d=8'hab;
81
+ 8'h0f: d=8'h76;
82
+ 8'h10: d=8'hca;
83
+ 8'h11: d=8'h82;
84
+ 8'h12: d=8'hc9;
85
+ 8'h13: d=8'h7d;
86
+ 8'h14: d=8'hfa;
87
+ 8'h15: d=8'h59;
88
+ 8'h16: d=8'h47;
89
+ 8'h17: d=8'hf0;
90
+ 8'h18: d=8'had;
91
+ 8'h19: d=8'hd4;
92
+ 8'h1a: d=8'ha2;
93
+ 8'h1b: d=8'haf;
94
+ 8'h1c: d=8'h9c;
95
+ 8'h1d: d=8'ha4;
96
+ 8'h1e: d=8'h72;
97
+ 8'h1f: d=8'hc0;
98
+ 8'h20: d=8'hb7;
99
+ 8'h21: d=8'hfd;
100
+ 8'h22: d=8'h93;
101
+ 8'h23: d=8'h26;
102
+ 8'h24: d=8'h36;
103
+ 8'h25: d=8'h3f;
104
+ 8'h26: d=8'hf7;
105
+ 8'h27: d=8'hcc;
106
+ 8'h28: d=8'h34;
107
+ 8'h29: d=8'ha5;
108
+ 8'h2a: d=8'he5;
109
+ 8'h2b: d=8'hf1;
110
+ 8'h2c: d=8'h71;
111
+ 8'h2d: d=8'hd8;
112
+ 8'h2e: d=8'h31;
113
+ 8'h2f: d=8'h15;
114
+ 8'h30: d=8'h04;
115
+ 8'h31: d=8'hc7;
116
+ 8'h32: d=8'h23;
117
+ 8'h33: d=8'hc3;
118
+ 8'h34: d=8'h18;
119
+ 8'h35: d=8'h96;
120
+ 8'h36: d=8'h05;
121
+ 8'h37: d=8'h9a;
122
+ 8'h38: d=8'h07;
123
+ 8'h39: d=8'h12;
124
+ 8'h3a: d=8'h80;
125
+ 8'h3b: d=8'he2;
126
+ 8'h3c: d=8'heb;
127
+ 8'h3d: d=8'h27;
128
+ 8'h3e: d=8'hb2;
129
+ 8'h3f: d=8'h75;
130
+ 8'h40: d=8'h09;
131
+ 8'h41: d=8'h83;
132
+ 8'h42: d=8'h2c;
133
+ 8'h43: d=8'h1a;
134
+ 8'h44: d=8'h1b;
135
+ 8'h45: d=8'h6e;
136
+ 8'h46: d=8'h5a;
137
+ 8'h47: d=8'ha0;
138
+ 8'h48: d=8'h52;
139
+ 8'h49: d=8'h3b;
140
+ 8'h4a: d=8'hd6;
141
+ 8'h4b: d=8'hb3;
142
+ 8'h4c: d=8'h29;
143
+ 8'h4d: d=8'he3;
144
+ 8'h4e: d=8'h2f;
145
+ 8'h4f: d=8'h84;
146
+ 8'h50: d=8'h53;
147
+ 8'h51: d=8'hd1;
148
+ 8'h52: d=8'h00;
149
+ 8'h53: d=8'hed;
150
+ 8'h54: d=8'h20;
151
+ 8'h55: d=8'hfc;
152
+ 8'h56: d=8'hb1;
153
+ 8'h57: d=8'h5b;
154
+ 8'h58: d=8'h6a;
155
+ 8'h59: d=8'hcb;
156
+ 8'h5a: d=8'hbe;
157
+ 8'h5b: d=8'h39;
158
+ 8'h5c: d=8'h4a;
159
+ 8'h5d: d=8'h4c;
160
+ 8'h5e: d=8'h58;
161
+ 8'h5f: d=8'hcf;
162
+ 8'h60: d=8'hd0;
163
+ 8'h61: d=8'hef;
164
+ 8'h62: d=8'haa;
165
+ 8'h63: d=8'hfb;
166
+ 8'h64: d=8'h43;
167
+ 8'h65: d=8'h4d;
168
+ 8'h66: d=8'h33;
169
+ 8'h67: d=8'h85;
170
+ 8'h68: d=8'h45;
171
+ 8'h69: d=8'hf9;
172
+ 8'h6a: d=8'h02;
173
+ 8'h6b: d=8'h7f;
174
+ 8'h6c: d=8'h50;
175
+ 8'h6d: d=8'h3c;
176
+ 8'h6e: d=8'h9f;
177
+ 8'h6f: d=8'ha8;
178
+ 8'h70: d=8'h51;
179
+ 8'h71: d=8'ha3;
180
+ 8'h72: d=8'h40;
181
+ 8'h73: d=8'h8f;
182
+ 8'h74: d=8'h92;
183
+ 8'h75: d=8'h9d;
184
+ 8'h76: d=8'h38;
185
+ 8'h77: d=8'hf5;
186
+ 8'h78: d=8'hbc;
187
+ 8'h79: d=8'hb6;
188
+ 8'h7a: d=8'hda;
189
+ 8'h7b: d=8'h21;
190
+ 8'h7c: d=8'h10;
191
+ 8'h7d: d=8'hff;
192
+ 8'h7e: d=8'hf3;
193
+ 8'h7f: d=8'hd2;
194
+ 8'h80: d=8'hcd;
195
+ 8'h81: d=8'h0c;
196
+ 8'h82: d=8'h13;
197
+ 8'h83: d=8'hec;
198
+ 8'h84: d=8'h5f;
199
+ 8'h85: d=8'h97;
200
+ 8'h86: d=8'h44;
201
+ 8'h87: d=8'h17;
202
+ 8'h88: d=8'hc4;
203
+ 8'h89: d=8'ha7;
204
+ 8'h8a: d=8'h7e;
205
+ 8'h8b: d=8'h3d;
206
+ 8'h8c: d=8'h64;
207
+ 8'h8d: d=8'h5d;
208
+ 8'h8e: d=8'h19;
209
+ 8'h8f: d=8'h73;
210
+ 8'h90: d=8'h60;
211
+ 8'h91: d=8'h81;
212
+ 8'h92: d=8'h4f;
213
+ 8'h93: d=8'hdc;
214
+ 8'h94: d=8'h22;
215
+ 8'h95: d=8'h2a;
216
+ 8'h96: d=8'h90;
217
+ 8'h97: d=8'h88;
218
+ 8'h98: d=8'h46;
219
+ 8'h99: d=8'hee;
220
+ 8'h9a: d=8'hb8;
221
+ 8'h9b: d=8'h14;
222
+ 8'h9c: d=8'hde;
223
+ 8'h9d: d=8'h5e;
224
+ 8'h9e: d=8'h0b;
225
+ 8'h9f: d=8'hdb;
226
+ 8'ha0: d=8'he0;
227
+ 8'ha1: d=8'h32;
228
+ 8'ha2: d=8'h3a;
229
+ 8'ha3: d=8'h0a;
230
+ 8'ha4: d=8'h49;
231
+ 8'ha5: d=8'h06;
232
+ 8'ha6: d=8'h24;
233
+ 8'ha7: d=8'h5c;
234
+ 8'ha8: d=8'hc2;
235
+ 8'ha9: d=8'hd3;
236
+ 8'haa: d=8'hac;
237
+ 8'hab: d=8'h62;
238
+ 8'hac: d=8'h91;
239
+ 8'had: d=8'h95;
240
+ 8'hae: d=8'he4;
241
+ 8'haf: d=8'h79;
242
+ 8'hb0: d=8'he7;
243
+ 8'hb1: d=8'hc8;
244
+ 8'hb2: d=8'h37;
245
+ 8'hb3: d=8'h6d;
246
+ 8'hb4: d=8'h8d;
247
+ 8'hb5: d=8'hd5;
248
+ 8'hb6: d=8'h4e;
249
+ 8'hb7: d=8'ha9;
250
+ 8'hb8: d=8'h6c;
251
+ 8'hb9: d=8'h56;
252
+ 8'hba: d=8'hf4;
253
+ 8'hbb: d=8'hea;
254
+ 8'hbc: d=8'h65;
255
+ 8'hbd: d=8'h7a;
256
+ 8'hbe: d=8'hae;
257
+ 8'hbf: d=8'h08;
258
+ 8'hc0: d=8'hba;
259
+ 8'hc1: d=8'h78;
260
+ 8'hc2: d=8'h25;
261
+ 8'hc3: d=8'h2e;
262
+ 8'hc4: d=8'h1c;
263
+ 8'hc5: d=8'ha6;
264
+ 8'hc6: d=8'hb4;
265
+ 8'hc7: d=8'hc6;
266
+ 8'hc8: d=8'he8;
267
+ 8'hc9: d=8'hdd;
268
+ 8'hca: d=8'h74;
269
+ 8'hcb: d=8'h1f;
270
+ 8'hcc: d=8'h4b;
271
+ 8'hcd: d=8'hbd;
272
+ 8'hce: d=8'h8b;
273
+ 8'hcf: d=8'h8a;
274
+ 8'hd0: d=8'h70;
275
+ 8'hd1: d=8'h3e;
276
+ 8'hd2: d=8'hb5;
277
+ 8'hd3: d=8'h66;
278
+ 8'hd4: d=8'h48;
279
+ 8'hd5: d=8'h03;
280
+ 8'hd6: d=8'hf6;
281
+ 8'hd7: d=8'h0e;
282
+ 8'hd8: d=8'h61;
283
+ 8'hd9: d=8'h35;
284
+ 8'hda: d=8'h57;
285
+ 8'hdb: d=8'hb9;
286
+ 8'hdc: d=8'h86;
287
+ 8'hdd: d=8'hc1;
288
+ 8'hde: d=8'h1d;
289
+ 8'hdf: d=8'h9e;
290
+ 8'he0: d=8'he1;
291
+ 8'he1: d=8'hf8;
292
+ 8'he2: d=8'h98;
293
+ 8'he3: d=8'h11;
294
+ 8'he4: d=8'h69;
295
+ 8'he5: d=8'hd9;
296
+ 8'he6: d=8'h8e;
297
+ 8'he7: d=8'h94;
298
+ 8'he8: d=8'h9b;
299
+ 8'he9: d=8'h1e;
300
+ 8'hea: d=8'h87;
301
+ 8'heb: d=8'he9;
302
+ 8'hec: d=8'hce;
303
+ 8'hed: d=8'h55;
304
+ 8'hee: d=8'h28;
305
+ 8'hef: d=8'hdf;
306
+ 8'hf0: d=8'h8c;
307
+ 8'hf1: d=8'ha1;
308
+ 8'hf2: d=8'h89;
309
+ 8'hf3: d=8'h0d;
310
+ 8'hf4: d=8'hbf;
311
+ 8'hf5: d=8'he6;
312
+ 8'hf6: d=8'h42;
313
+ 8'hf7: d=8'h68;
314
+ 8'hf8: d=8'h41;
315
+ 8'hf9: d=8'h99;
316
+ 8'hfa: d=8'h2d;
317
+ 8'hfb: d=8'h0f;
318
+ 8'hfc: d=8'hb0;
319
+ 8'hfd: d=8'h54;
320
+ 8'hfe: d=8'hbb;
321
+ 8'hff: d=8'h16;
322
+ endcase
323
+
324
+ endmodule
325
+
326
+
chips/openroad_flow_scripts/flow/designs/src/aes/timescale.v ADDED
@@ -0,0 +1 @@
 
 
1
+ `timescale 1ns / 10ps
chips/openroad_flow_scripts/flow/designs/src/ariane/LICENSE ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SOLDERPAD HARDWARE LICENSE version 0.51
2
+
3
+ This license is based closely on the Apache License Version 2.0, but is not
4
+ approved or endorsed by the Apache Foundation. A copy of the non-modified
5
+ Apache License 2.0 can be found at http://www.apache.org/licenses/LICENSE-2.0.
6
+
7
+ As this license is not currently OSI or FSF approved, the Licensor permits any
8
+ Work licensed under this License, at the option of the Licensee, to be treated
9
+ as licensed under the Apache License Version 2.0 (which is so approved).
10
+
11
+ This License is licensed under the terms of this License and in particular
12
+ clause 7 below (Disclaimer of Warranties) applies in relation to its use.
13
+
14
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
15
+
16
+ 1. Definitions.
17
+
18
+ “License” shall mean the terms and conditions for use, reproduction, and
19
+ distribution as defined by Sections 1 through 9 of this document.
20
+
21
+ “Licensor” shall mean the Rights owner or entity authorized by the Rights owner
22
+ that is granting the License.
23
+
24
+ “Legal Entity” shall mean the union of the acting entity and all other entities
25
+ that control, are controlled by, or are under common control with that entity.
26
+ For the purposes of this definition, “control” means (i) the power, direct or
27
+ indirect, to cause the direction or management of such entity, whether by
28
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
29
+ outstanding shares, or (iii) beneficial ownership of such entity.
30
+
31
+ “You” (or “Your”) shall mean an individual or Legal Entity exercising
32
+ permissions granted by this License.
33
+
34
+ “Rights” means copyright and any similar right including design right (whether
35
+ registered or unregistered), semiconductor topography (mask) rights and
36
+ database rights (but excluding Patents and Trademarks).
37
+
38
+ “Source” form shall mean the preferred form for making modifications, including
39
+ but not limited to source code, net lists, board layouts, CAD files,
40
+ documentation source, and configuration files.
41
+
42
+ “Object” form shall mean any form resulting from mechanical transformation or
43
+ translation of a Source form, including but not limited to compiled object
44
+ code, generated documentation, the instantiation of a hardware design and
45
+ conversions to other media types, including intermediate forms such as
46
+ bytecodes, FPGA bitstreams, artwork and semiconductor topographies (mask
47
+ works).
48
+
49
+ “Work” shall mean the work of authorship, whether in Source form or other
50
+ Object form, made available under the License, as indicated by a Rights notice
51
+ that is included in or attached to the work (an example is provided in the
52
+ Appendix below).
53
+
54
+ “Derivative Works” shall mean any work, whether in Source or Object form, that
55
+ is based on (or derived from) the Work and for which the editorial revisions,
56
+ annotations, elaborations, or other modifications represent, as a whole, an
57
+ original work of authorship. For the purposes of this License, Derivative Works
58
+ shall not include works that remain separable from, or merely link (or bind by
59
+ name) or physically connect to or interoperate with the interfaces of, the Work
60
+ and Derivative Works thereof.
61
+
62
+ “Contribution” shall mean any design or work of authorship, including the
63
+ original version of the Work and any modifications or additions to that Work or
64
+ Derivative Works thereof, that is intentionally submitted to Licensor for
65
+ inclusion in the Work by the Rights owner or by an individual or Legal Entity
66
+ authorized to submit on behalf of the Rights owner. For the purposes of this
67
+ definition, “submitted” means any form of electronic, verbal, or written
68
+ communication sent to the Licensor or its representatives, including but not
69
+ limited to communication on electronic mailing lists, source code control
70
+ systems, and issue tracking systems that are managed by, or on behalf of, the
71
+ Licensor for the purpose of discussing and improving the Work, but excluding
72
+ communication that is conspicuously marked or otherwise designated in writing
73
+ by the Rights owner as “Not a Contribution.”
74
+
75
+ “Contributor” shall mean Licensor and any individual or Legal Entity on behalf
76
+ of whom a Contribution has been received by Licensor and subsequently
77
+ incorporated within the Work.
78
+
79
+ 2. Grant of License. Subject to the terms and conditions of this License, each
80
+ Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
81
+ no-charge, royalty-free, irrevocable license under the Rights to reproduce,
82
+ prepare Derivative Works of, publicly display, publicly perform, sublicense,
83
+ and distribute the Work and such Derivative Works in Source or Object form and
84
+ do anything in relation to the Work as if the Rights did not exist.
85
+
86
+ 3. Grant of Patent License. Subject to the terms and conditions of this
87
+ License, each Contributor hereby grants to You a perpetual, worldwide,
88
+ non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
89
+ section) patent license to make, have made, use, offer to sell, sell, import,
90
+ and otherwise transfer the Work, where such license applies only to those
91
+ patent claims licensable by such Contributor that are necessarily infringed by
92
+ their Contribution(s) alone or by combination of their Contribution(s) with the
93
+ Work to which such Contribution(s) was submitted. If You institute patent
94
+ litigation against any entity (including a cross-claim or counterclaim in a
95
+ lawsuit) alleging that the Work or a Contribution incorporated within the Work
96
+ constitutes direct or contributory patent infringement, then any patent
97
+ licenses granted to You under this License for that Work shall terminate as of
98
+ the date such litigation is filed.
99
+
100
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
101
+ Derivative Works thereof in any medium, with or without modifications, and in
102
+ Source or Object form, provided that You meet the following conditions:
103
+
104
+ You must give any other recipients of the Work or Derivative Works a copy
105
+ of this License; and
106
+
107
+ You must cause any modified files to carry prominent notices stating that
108
+ You changed the files; and
109
+
110
+ You must retain, in the Source form of any Derivative Works that You
111
+ distribute, all copyright, patent, trademark, and attribution notices from
112
+ the Source form of the Work, excluding those notices that do not pertain to
113
+ any part of the Derivative Works; and
114
+
115
+ If the Work includes a “NOTICE” text file as part of its distribution, then
116
+ any Derivative Works that You distribute must include a readable copy of
117
+ the attribution notices contained within such NOTICE file, excluding those
118
+ notices that do not pertain to any part of the Derivative Works, in at
119
+ least one of the following places: within a NOTICE text file distributed as
120
+ part of the Derivative Works; within the Source form or documentation, if
121
+ provided along with the Derivative Works; or, within a display generated by
122
+ the Derivative Works, if and wherever such third-party notices normally
123
+ appear. The contents of the NOTICE file are for informational purposes only
124
+ and do not modify the License. You may add Your own attribution notices
125
+ within Derivative Works that You distribute, alongside or as an addendum to
126
+ the NOTICE text from the Work, provided that such additional attribution
127
+ notices cannot be construed as modifying the License. You may add Your own
128
+ copyright statement to Your modifications and may provide additional or
129
+ different license terms and conditions for use, reproduction, or
130
+ distribution of Your modifications, or for any such Derivative Works as a
131
+ whole, provided Your use, reproduction, and distribution of the Work
132
+ otherwise complies with the conditions stated in this License.
133
+
134
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
135
+ Contribution intentionally submitted for inclusion in the Work by You to the
136
+ Licensor shall be under the terms and conditions of this License, without any
137
+ additional terms or conditions. Notwithstanding the above, nothing herein shall
138
+ supersede or modify the terms of any separate license agreement you may have
139
+ executed with Licensor regarding such Contributions.
140
+
141
+ 6. Trademarks. This License does not grant permission to use the trade names,
142
+ trademarks, service marks, or product names of the Licensor, except as required
143
+ for reasonable and customary use in describing the origin of the Work and
144
+ reproducing the content of the NOTICE file.
145
+
146
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
147
+ writing, Licensor provides the Work (and each Contributor provides its
148
+ Contributions) on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
149
+ KIND, either express or implied, including, without limitation, any warranties
150
+ or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any risks
153
+ associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
156
+ tort (including negligence), contract, or otherwise, unless required by
157
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
158
+ writing, shall any Contributor be liable to You for damages, including any
159
+ direct, indirect, special, incidental, or consequential damages of any
160
+ character arising as a result of this License or out of the use or inability to
161
+ use the Work (including but not limited to damages for loss of goodwill, work
162
+ stoppage, computer failure or malfunction, or any and all other commercial
163
+ damages or losses), even if such Contributor has been advised of the
164
+ possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
167
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
168
+ acceptance of support, warranty, indemnity, or other liability obligations
169
+ and/or rights consistent with this License. However, in accepting such
170
+ obligations, You may act only on Your own behalf and on Your sole
171
+ responsibility, not on behalf of any other Contributor, and only if You agree
172
+ to indemnify, defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason of your
174
+ accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
chips/openroad_flow_scripts/flow/designs/src/ariane/README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Summary
2
+
3
+ Ariane Core.
4
+
5
+ # Source
6
+
7
+ Downloaded from https://github.com/pulp-platform/ariane in 03/2019.
8
+
9
+ # Modifications
10
+
11
+ - Added sdc timing constraints.
12
+ - Converted to verilog using `bsg_sv2v`.
13
+ - Added LICENSE file.
chips/openroad_flow_scripts/flow/designs/src/ariane/ariane.sv2v.v ADDED
The diff for this file is too large to render. See raw diff
 
chips/openroad_flow_scripts/flow/designs/src/ariane133/ariane.sv2v.v ADDED
The diff for this file is too large to render. See raw diff
 
chips/openroad_flow_scripts/flow/designs/src/ariane136/LICENSE ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SOLDERPAD HARDWARE LICENSE version 0.51
2
+
3
+ This license is based closely on the Apache License Version 2.0, but is not
4
+ approved or endorsed by the Apache Foundation. A copy of the non-modified
5
+ Apache License 2.0 can be found at http://www.apache.org/licenses/LICENSE-2.0.
6
+
7
+ As this license is not currently OSI or FSF approved, the Licensor permits any
8
+ Work licensed under this License, at the option of the Licensee, to be treated
9
+ as licensed under the Apache License Version 2.0 (which is so approved).
10
+
11
+ This License is licensed under the terms of this License and in particular
12
+ clause 7 below (Disclaimer of Warranties) applies in relation to its use.
13
+
14
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
15
+
16
+ 1. Definitions.
17
+
18
+ “License” shall mean the terms and conditions for use, reproduction, and
19
+ distribution as defined by Sections 1 through 9 of this document.
20
+
21
+ “Licensor” shall mean the Rights owner or entity authorized by the Rights owner
22
+ that is granting the License.
23
+
24
+ “Legal Entity” shall mean the union of the acting entity and all other entities
25
+ that control, are controlled by, or are under common control with that entity.
26
+ For the purposes of this definition, “control” means (i) the power, direct or
27
+ indirect, to cause the direction or management of such entity, whether by
28
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
29
+ outstanding shares, or (iii) beneficial ownership of such entity.
30
+
31
+ “You” (or “Your”) shall mean an individual or Legal Entity exercising
32
+ permissions granted by this License.
33
+
34
+ “Rights” means copyright and any similar right including design right (whether
35
+ registered or unregistered), semiconductor topography (mask) rights and
36
+ database rights (but excluding Patents and Trademarks).
37
+
38
+ “Source” form shall mean the preferred form for making modifications, including
39
+ but not limited to source code, net lists, board layouts, CAD files,
40
+ documentation source, and configuration files.
41
+
42
+ “Object” form shall mean any form resulting from mechanical transformation or
43
+ translation of a Source form, including but not limited to compiled object
44
+ code, generated documentation, the instantiation of a hardware design and
45
+ conversions to other media types, including intermediate forms such as
46
+ bytecodes, FPGA bitstreams, artwork and semiconductor topographies (mask
47
+ works).
48
+
49
+ “Work” shall mean the work of authorship, whether in Source form or other
50
+ Object form, made available under the License, as indicated by a Rights notice
51
+ that is included in or attached to the work (an example is provided in the
52
+ Appendix below).
53
+
54
+ “Derivative Works” shall mean any work, whether in Source or Object form, that
55
+ is based on (or derived from) the Work and for which the editorial revisions,
56
+ annotations, elaborations, or other modifications represent, as a whole, an
57
+ original work of authorship. For the purposes of this License, Derivative Works
58
+ shall not include works that remain separable from, or merely link (or bind by
59
+ name) or physically connect to or interoperate with the interfaces of, the Work
60
+ and Derivative Works thereof.
61
+
62
+ “Contribution” shall mean any design or work of authorship, including the
63
+ original version of the Work and any modifications or additions to that Work or
64
+ Derivative Works thereof, that is intentionally submitted to Licensor for
65
+ inclusion in the Work by the Rights owner or by an individual or Legal Entity
66
+ authorized to submit on behalf of the Rights owner. For the purposes of this
67
+ definition, “submitted” means any form of electronic, verbal, or written
68
+ communication sent to the Licensor or its representatives, including but not
69
+ limited to communication on electronic mailing lists, source code control
70
+ systems, and issue tracking systems that are managed by, or on behalf of, the
71
+ Licensor for the purpose of discussing and improving the Work, but excluding
72
+ communication that is conspicuously marked or otherwise designated in writing
73
+ by the Rights owner as “Not a Contribution.”
74
+
75
+ “Contributor” shall mean Licensor and any individual or Legal Entity on behalf
76
+ of whom a Contribution has been received by Licensor and subsequently
77
+ incorporated within the Work.
78
+
79
+ 2. Grant of License. Subject to the terms and conditions of this License, each
80
+ Contributor hereby grants to You a perpetual, worldwide, non-exclusive,
81
+ no-charge, royalty-free, irrevocable license under the Rights to reproduce,
82
+ prepare Derivative Works of, publicly display, publicly perform, sublicense,
83
+ and distribute the Work and such Derivative Works in Source or Object form and
84
+ do anything in relation to the Work as if the Rights did not exist.
85
+
86
+ 3. Grant of Patent License. Subject to the terms and conditions of this
87
+ License, each Contributor hereby grants to You a perpetual, worldwide,
88
+ non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
89
+ section) patent license to make, have made, use, offer to sell, sell, import,
90
+ and otherwise transfer the Work, where such license applies only to those
91
+ patent claims licensable by such Contributor that are necessarily infringed by
92
+ their Contribution(s) alone or by combination of their Contribution(s) with the
93
+ Work to which such Contribution(s) was submitted. If You institute patent
94
+ litigation against any entity (including a cross-claim or counterclaim in a
95
+ lawsuit) alleging that the Work or a Contribution incorporated within the Work
96
+ constitutes direct or contributory patent infringement, then any patent
97
+ licenses granted to You under this License for that Work shall terminate as of
98
+ the date such litigation is filed.
99
+
100
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
101
+ Derivative Works thereof in any medium, with or without modifications, and in
102
+ Source or Object form, provided that You meet the following conditions:
103
+
104
+ You must give any other recipients of the Work or Derivative Works a copy
105
+ of this License; and
106
+
107
+ You must cause any modified files to carry prominent notices stating that
108
+ You changed the files; and
109
+
110
+ You must retain, in the Source form of any Derivative Works that You
111
+ distribute, all copyright, patent, trademark, and attribution notices from
112
+ the Source form of the Work, excluding those notices that do not pertain to
113
+ any part of the Derivative Works; and
114
+
115
+ If the Work includes a “NOTICE” text file as part of its distribution, then
116
+ any Derivative Works that You distribute must include a readable copy of
117
+ the attribution notices contained within such NOTICE file, excluding those
118
+ notices that do not pertain to any part of the Derivative Works, in at
119
+ least one of the following places: within a NOTICE text file distributed as
120
+ part of the Derivative Works; within the Source form or documentation, if
121
+ provided along with the Derivative Works; or, within a display generated by
122
+ the Derivative Works, if and wherever such third-party notices normally
123
+ appear. The contents of the NOTICE file are for informational purposes only
124
+ and do not modify the License. You may add Your own attribution notices
125
+ within Derivative Works that You distribute, alongside or as an addendum to
126
+ the NOTICE text from the Work, provided that such additional attribution
127
+ notices cannot be construed as modifying the License. You may add Your own
128
+ copyright statement to Your modifications and may provide additional or
129
+ different license terms and conditions for use, reproduction, or
130
+ distribution of Your modifications, or for any such Derivative Works as a
131
+ whole, provided Your use, reproduction, and distribution of the Work
132
+ otherwise complies with the conditions stated in this License.
133
+
134
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
135
+ Contribution intentionally submitted for inclusion in the Work by You to the
136
+ Licensor shall be under the terms and conditions of this License, without any
137
+ additional terms or conditions. Notwithstanding the above, nothing herein shall
138
+ supersede or modify the terms of any separate license agreement you may have
139
+ executed with Licensor regarding such Contributions.
140
+
141
+ 6. Trademarks. This License does not grant permission to use the trade names,
142
+ trademarks, service marks, or product names of the Licensor, except as required
143
+ for reasonable and customary use in describing the origin of the Work and
144
+ reproducing the content of the NOTICE file.
145
+
146
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
147
+ writing, Licensor provides the Work (and each Contributor provides its
148
+ Contributions) on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
149
+ KIND, either express or implied, including, without limitation, any warranties
150
+ or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any risks
153
+ associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
156
+ tort (including negligence), contract, or otherwise, unless required by
157
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
158
+ writing, shall any Contributor be liable to You for damages, including any
159
+ direct, indirect, special, incidental, or consequential damages of any
160
+ character arising as a result of this License or out of the use or inability to
161
+ use the Work (including but not limited to damages for loss of goodwill, work
162
+ stoppage, computer failure or malfunction, or any and all other commercial
163
+ damages or losses), even if such Contributor has been advised of the
164
+ possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
167
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
168
+ acceptance of support, warranty, indemnity, or other liability obligations
169
+ and/or rights consistent with this License. However, in accepting such
170
+ obligations, You may act only on Your own behalf and on Your sole
171
+ responsibility, not on behalf of any other Contributor, and only if You agree
172
+ to indemnify, defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason of your
174
+ accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
chips/openroad_flow_scripts/flow/designs/src/ariane136/README.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Summary
2
+
3
+ Ariane Core.
4
+
5
+ # Source
6
+
7
+ Downloaded from https://github.com/pulp-platform/ariane in 03/2019.
8
+
9
+ # Modifications
10
+
11
+ - Added sdc timing constraints.
12
+ - Converted to verilog using `bsg_sv2v`.
13
+ - Changed RTL to use 136 memories to track google brain Ciruit Training test case
14
+ - Added LICENSE file.
chips/openroad_flow_scripts/flow/designs/src/ariane136/ariane.sv2v.v ADDED
The diff for this file is too large to render. See raw diff
 
chips/openroad_flow_scripts/flow/designs/src/black_parrot/LICENSE ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2019, University of Washington
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+ * Redistributions of source code must retain the above copyright
7
+ notice, this list of conditions and the following disclaimer.
8
+ * Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+ * Neither the name of the University of Washington nor the
12
+ names of its contributors may be used to endorse or promote products
13
+ derived from this software without specific prior written permission.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY
19
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
chips/openroad_flow_scripts/flow/designs/src/black_parrot/README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Summary
2
+
3
+ `black_parrot_2019_03_28` Full 64-bit RISC-V Core with Cache Coherence Directory.
4
+
5
+ # Source
6
+
7
+ Cloned from README (`commit a6b8be03ed88467269efabeaf168459d14199c69`).
8
+
9
+ # Modifications
10
+
11
+ - Generated memory using [`bsg_fakeram` for `nangate45`](https://github.com/bespoke-silicon-group/bsg_fakeram).
12
+ - Hardened memory blocks.
13
+ - Added timing constraints.
chips/openroad_flow_scripts/flow/designs/src/black_parrot/pickled.v ADDED
The diff for this file is too large to render. See raw diff
 
chips/openroad_flow_scripts/flow/designs/src/bp_be_top/LICENSE ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2019, University of Washington
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+ * Redistributions of source code must retain the above copyright
7
+ notice, this list of conditions and the following disclaimer.
8
+ * Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+ * Neither the name of the University of Washington nor the
12
+ names of its contributors may be used to endorse or promote products
13
+ derived from this software without specific prior written permission.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY
19
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
chips/openroad_flow_scripts/flow/designs/src/bp_be_top/README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Summary
2
+
3
+ `black_parrot_be_only_2019_03_11` - Back-end of a 64-bit RISC-V Core with Cache Coherence Directory.
4
+
5
+ # Source
6
+
7
+ Cloned from README (`commit a6b8be03ed88467269efabeaf168459d14199c69`).
8
+
9
+ # Modifications
10
+
11
+ - Generated memory using [`bsg_fakeram` for `nangate45`](https://github.com/bespoke-silicon-group/bsg_fakeram).
12
+ - Hardened memory blocks.
13
+ - Added timing constraints.
chips/openroad_flow_scripts/flow/designs/src/bp_be_top/pickled.v ADDED
The diff for this file is too large to render. See raw diff
 
chips/openroad_flow_scripts/flow/designs/src/bp_fe_top/LICENSE ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2019, University of Washington
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+ * Redistributions of source code must retain the above copyright
7
+ notice, this list of conditions and the following disclaimer.
8
+ * Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+ * Neither the name of the University of Washington nor the
12
+ names of its contributors may be used to endorse or promote products
13
+ derived from this software without specific prior written permission.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY
19
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
chips/openroad_flow_scripts/flow/designs/src/bp_fe_top/README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Summary
2
+
3
+ `black_parrot_fe_only_2019_03_11` Front-end of a 64-bit RISC-V Core with Cache Coherence Directory.
4
+
5
+ # Source
6
+
7
+ Cloned from README (`commit a6b8be03ed88467269efabeaf168459d14199c69`).
8
+
9
+ # Modifications
10
+
11
+ - Generated memory using [`bsg_fakeram` for `nangate45`](https://github.com/bespoke-silicon-group/bsg_fakeram).
12
+ - Hardened memory blocks.
13
+ - Added timing constraints.
chips/openroad_flow_scripts/flow/designs/src/bp_fe_top/pickled.v ADDED
The diff for this file is too large to render. See raw diff
 
chips/openroad_flow_scripts/flow/designs/src/bp_multi_top/LICENSE ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2019, University of Washington
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+ * Redistributions of source code must retain the above copyright
7
+ notice, this list of conditions and the following disclaimer.
8
+ * Redistributions in binary form must reproduce the above copyright
9
+ notice, this list of conditions and the following disclaimer in the
10
+ documentation and/or other materials provided with the distribution.
11
+ * Neither the name of the University of Washington nor the
12
+ names of its contributors may be used to endorse or promote products
13
+ derived from this software without specific prior written permission.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ DISCLAIMED. IN NO EVENT SHALL UNIVERSITY OF WASHINGTON BE LIABLE FOR ANY
19
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
chips/openroad_flow_scripts/flow/designs/src/bp_multi_top/README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Summary
2
+
3
+ `black_parrot_2019_03_11` Full 64-bit RISC-V Core with Cache Coherence Directory.
4
+
5
+ # Source
6
+
7
+ Cloned from README (`commit a6b8be03ed88467269efabeaf168459d14199c69`).
8
+
9
+ # Modifications
10
+
11
+ - Generated memory using [`bsg_fakeram` for `nangate45`](https://github.com/bespoke-silicon-group/bsg_fakeram).
12
+ - Hardened memory blocks.
13
+ - Added timing constraints.
chips/openroad_flow_scripts/flow/designs/src/bp_multi_top/pickled.v ADDED
The diff for this file is too large to render. See raw diff
 
chips/openroad_flow_scripts/flow/designs/src/bp_quad/bsg_chip_block.sv2v.v ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc092ebae74ebc6a892be2c30b941c0c0aebb33cdab8ceebcb93a6b79e4114b8
3
+ size 13117017
chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/AHBlite_GPIO.v ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ `timescale 1ns/1ns
2
+ module AHBlite_GPIO (
3
+ // AHB Interface
4
+ // clock and reset
5
+ input wire HCLK,
6
+ //input wire HCLKG, // Gated clock
7
+ input wire HRESETn, // Reset
8
+
9
+ // input ports
10
+ input wire HSEL, // Select
11
+ input wire [23:2] HADDR, // Address
12
+ input wire HREADY, //
13
+ input wire HWRITE, // Write control
14
+ input wire [1:0] HTRANS, // AHB transfer type
15
+ input wire [2:0] HSIZE, // AHB hsize
16
+ input wire [31:0] HWDATA, // Write data
17
+
18
+ // output ports
19
+ output wire [31:0] HRDATA, // Read data
20
+ output wire HREADYOUT, // Device ready
21
+ output wire [1:0] HRESP,
22
+
23
+ output wire [15:0] IRQ,
24
+
25
+ // IP Interface
26
+ // WGPIODIN register/fields
27
+ input [15:0] WGPIODIN,
28
+ // WGPIODOUT register/fields
29
+ output [15:0] WGPIODOUT,
30
+ // WGPIOPU register/fields
31
+ output [15:0] WGPIOPU,
32
+ // WGPIOPD register/fields
33
+ output [15:0] WGPIOPD,
34
+ // WGPIODIR register/fields
35
+ output [15:0] WGPIODIR
36
+ );
37
+ reg IOSEL;
38
+ reg [23:0] IOADDR;
39
+ reg IOWRITE; // I/O transfer direction
40
+ reg [2:0] IOSIZE; // I/O transfer size
41
+ reg IOTRANS;
42
+
43
+ // registered HSEL, update only if selected to reduce toggling
44
+ always @(posedge HCLK or negedge HRESETn) begin
45
+ if (~HRESETn)
46
+ IOSEL <= 1'b0;
47
+ else
48
+ IOSEL <= HSEL & HREADY;
49
+ end
50
+
51
+ // registered address, update only if selected to reduce toggling
52
+ always @(posedge HCLK or negedge HRESETn) begin
53
+ if (~HRESETn)
54
+ IOADDR <= 24'd0;
55
+ else
56
+ IOADDR <= {HADDR[23:2], 2'b0};
57
+ end
58
+
59
+ // Data phase write control
60
+ always @(posedge HCLK or negedge HRESETn)
61
+ begin
62
+ if (~HRESETn)
63
+ IOWRITE <= 1'b0;
64
+ else
65
+ IOWRITE <= HWRITE;
66
+ end
67
+
68
+ // registered hsize, update only if selected to reduce toggling
69
+ always @(posedge HCLK or negedge HRESETn)
70
+ begin
71
+ if (~HRESETn)
72
+ IOSIZE <= {3{1'b0}};
73
+ else
74
+ IOSIZE <= HSIZE[2:0];
75
+ end
76
+
77
+ // registered HTRANS, update only if selected to reduce toggling
78
+ always @(posedge HCLK or negedge HRESETn)
79
+ begin
80
+ if (~HRESETn)
81
+ IOTRANS <= 1'b0;
82
+ else
83
+ IOTRANS <= HTRANS[1];
84
+ end
85
+
86
+ wire rd_enable;
87
+ assign rd_enable = IOSEL & (~IOWRITE) & IOTRANS;
88
+ wire wr_enable = IOTRANS & IOWRITE & IOSEL;
89
+
90
+
91
+ reg [15:0] WGPIODOUT;
92
+ reg [15:0] WGPIOPU;
93
+ reg [15:0] WGPIOPD;
94
+ reg [15:0] WGPIODIR;
95
+ reg [15:0] WGPIOIM;
96
+ wire[15:0] WGPIODIN;
97
+
98
+ // Register: WGPIODOUT
99
+ wire WGPIODOUT_select = wr_enable & (IOADDR[23:2] == 22'h1);
100
+
101
+ always @(posedge HCLK or negedge HRESETn)
102
+ begin
103
+ if (~HRESETn)
104
+ WGPIODOUT <= 16'h0;
105
+ else if (WGPIODOUT_select)
106
+ WGPIODOUT <= HWDATA;
107
+ end
108
+
109
+ // Register: WGPIOPU
110
+ wire WGPIOPU_select = wr_enable & (IOADDR[23:2] == 22'h2);
111
+
112
+ always @(posedge HCLK or negedge HRESETn)
113
+ begin
114
+ if (~HRESETn)
115
+ WGPIOPU <= 16'h0;
116
+ else if (WGPIOPU_select)
117
+ WGPIOPU <= HWDATA;
118
+ end
119
+
120
+ // Register: WGPIOPD
121
+ wire WGPIOPD_select = wr_enable & (IOADDR[23:2] == 22'h3);
122
+
123
+ always @(posedge HCLK or negedge HRESETn)
124
+ begin
125
+ if (~HRESETn)
126
+ WGPIOPD <= 16'h0;
127
+ else if (WGPIOPD_select)
128
+ WGPIOPD <= HWDATA;
129
+ end
130
+
131
+ // Register: WGPIODIR
132
+ wire WGPIODIR_select = wr_enable & (IOADDR[23:2] == 22'h4);
133
+
134
+ always @(posedge HCLK or negedge HRESETn)
135
+ begin
136
+ if (~HRESETn)
137
+ WGPIODIR <= 16'h0;
138
+ else if (WGPIODIR_select)
139
+ WGPIODIR <= HWDATA;
140
+ end
141
+
142
+ // Register: IM
143
+ wire WGPIOIM_select = wr_enable & (IOADDR[23:2] == 22'h5);
144
+
145
+ always @(posedge HCLK or negedge HRESETn)
146
+ begin
147
+ if (~HRESETn)
148
+ WGPIOIM <= 16'h0;
149
+ else if (WGPIOIM_select)
150
+ WGPIOIM <= HWDATA;
151
+ end
152
+
153
+ assign IRQ = (~WGPIODIR) & WGPIOIM;
154
+
155
+ assign HRDATA =
156
+ (IOADDR[23:2] == 22'h0) ? {16'd0,WGPIODIN} :
157
+ (IOADDR[23:2] == 22'h1) ? {16'd0,WGPIODOUT} :
158
+ (IOADDR[23:2] == 22'h2) ? {16'd0,WGPIOPU} :
159
+ (IOADDR[23:2] == 22'h3) ? {16'd0,WGPIOPD} :
160
+ (IOADDR[23:2] == 22'h4) ? {16'd0,WGPIODIR} :
161
+ (IOADDR[23:2] == 22'h5) ? {16'd0,WGPIOIM} :
162
+ 32'hDEADBEEF;
163
+ assign HREADYOUT = 1'b1; // Always ready
164
+
165
+ endmodule
chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/AHBlite_bus0.v ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ `timescale 1ns/1ns
3
+ module AHBlite_BUS0(
4
+ input wire HCLK,
5
+ input wire HRESETn,
6
+
7
+ // Master Interface
8
+ input wire [31:0] HADDR,
9
+ input wire [31:0] HWDATA,
10
+ output wire [31:0] HRDATA,
11
+ output wire HREADY,
12
+ // Slave # 0
13
+ output wire HSEL_S0,
14
+ input wire HREADY_S0,
15
+ input wire [31:0] HRDATA_S0,
16
+ // Slave # 1
17
+ output wire HSEL_S1,
18
+ input wire HREADY_S1,
19
+ input wire [31:0] HRDATA_S1,
20
+ // Slave # 2
21
+ output wire HSEL_S2,
22
+ input wire HREADY_S2,
23
+ input wire [31:0] HRDATA_S2,
24
+ // Slave # 3
25
+ output wire HSEL_S3,
26
+ input wire HREADY_S3,
27
+ input wire [31:0] HRDATA_S3,
28
+
29
+ // Slave # 4
30
+ output wire HSEL_S4,
31
+ input wire HREADY_S4,
32
+ input wire [31:0] HRDATA_S4,
33
+
34
+
35
+ // SubSystem # 0
36
+ output wire HSEL_SS0,
37
+ input wire HREADY_SS0,
38
+ input wire [31:0] HRDATA_SS0
39
+ );
40
+ wire [7:0] PAGE = HADDR[31:24];
41
+ reg [7:0] APAGE;
42
+
43
+ always@ (posedge HCLK or negedge HRESETn) begin
44
+ if(!HRESETn)
45
+ APAGE <= 8'h0;
46
+ else if(HREADY)
47
+ APAGE <= PAGE;
48
+ end
49
+
50
+ assign HSEL_S0 = (PAGE == 8'h00);
51
+ assign HSEL_S1 = (PAGE == 8'h20);
52
+ assign HSEL_S2 = (PAGE == 8'h48);
53
+ assign HSEL_S3 = (PAGE == 8'h49);
54
+ assign HSEL_S4 = (PAGE == 8'h4A);
55
+ assign HSEL_SS0 = (PAGE == 8'h40);
56
+
57
+
58
+ assign HREADY =
59
+ (APAGE == 8'h00) ? HREADY_S0 :
60
+ (APAGE == 8'h20) ? HREADY_S1 :
61
+ (APAGE == 8'h48) ? HREADY_S2 :
62
+ (APAGE == 8'h49) ? HREADY_S3 :
63
+ (APAGE == 8'h4A) ? HREADY_S4 :
64
+ (APAGE == 8'h40) ? HREADY_SS0 :
65
+ 1'b1;
66
+
67
+
68
+ assign HRDATA =
69
+ (APAGE == 8'h00) ? HRDATA_S0 :
70
+ (APAGE == 8'h20) ? HRDATA_S1 :
71
+ (APAGE == 8'h48) ? HRDATA_S2 :
72
+ (APAGE == 8'h49) ? HRDATA_S3 :
73
+ (APAGE == 8'h4A) ? HRDATA_S4 :
74
+ (APAGE == 8'h40) ? HRDATA_SS0 :
75
+ 32'hDEADBEEF;
76
+
77
+ endmodule
chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/AHBlite_db_reg.v ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ `timescale 1ns/1ns
2
+ module AHBlite_db_reg (
3
+ // AHB Interface
4
+ // clock and reset
5
+ input wire HCLK,
6
+ //input wire HCLKG, // Gated clock
7
+ input wire HRESETn, // Reset
8
+
9
+ // input ports
10
+ input wire HSEL, // Select
11
+ input wire [23:2] HADDR, // Address
12
+ input wire HREADY, //
13
+ input wire HWRITE, // Write control
14
+ input wire [1:0] HTRANS, // AHB transfer type
15
+ input wire [2:0] HSIZE, // AHB hsize
16
+ input wire [31:0] HWDATA, // Write data
17
+
18
+ // output ports
19
+ output wire [31:0] HRDATA, // Read data
20
+ output wire HREADYOUT, // Device ready
21
+ output wire [1:0] HRESP,
22
+ // IP Interface
23
+ // db_reg register/fields
24
+ output [3:0] db_reg
25
+
26
+
27
+ );
28
+ reg IOSEL;
29
+ reg [23:0] IOADDR;
30
+ reg IOWRITE; // I/O transfer direction
31
+ reg [2:0] IOSIZE; // I/O transfer size
32
+ reg IOTRANS;
33
+
34
+ // registered HSEL, update only if selected to reduce toggling
35
+ always @(posedge HCLK or negedge HRESETn) begin
36
+ if (~HRESETn)
37
+ IOSEL <= 1'b0;
38
+ else
39
+ IOSEL <= HSEL & HREADY;
40
+ end
41
+
42
+ // registered address, update only if selected to reduce toggling
43
+ always @(posedge HCLK or negedge HRESETn) begin
44
+ if (~HRESETn)
45
+ IOADDR <= 24'd0;
46
+ else
47
+ IOADDR <= HADDR[23:0];
48
+ end
49
+
50
+ // Data phase write control
51
+ always @(posedge HCLK or negedge HRESETn)
52
+ begin
53
+ if (~HRESETn)
54
+ IOWRITE <= 1'b0;
55
+ else
56
+ IOWRITE <= HWRITE;
57
+ end
58
+
59
+ // registered hsize, update only if selected to reduce toggling
60
+ always @(posedge HCLK or negedge HRESETn)
61
+ begin
62
+ if (~HRESETn)
63
+ IOSIZE <= {3{1'b0}};
64
+ else
65
+ IOSIZE <= HSIZE[2:0];
66
+ end
67
+
68
+ // registered HTRANS, update only if selected to reduce toggling
69
+ always @(posedge HCLK or negedge HRESETn)
70
+ begin
71
+ if (~HRESETn)
72
+ IOTRANS <= 1'b0;
73
+ else
74
+ IOTRANS <= HTRANS[1];
75
+ end
76
+
77
+ wire rd_enable;
78
+ assign rd_enable = IOSEL & (~IOWRITE) & IOTRANS;
79
+ wire wr_enable = IOTRANS & IOWRITE & IOSEL;
80
+
81
+
82
+ reg [3:0] db_reg;
83
+
84
+
85
+ // Register: db_reg
86
+ wire db_reg_select = wr_enable & (IOADDR[23:2] == 20'h0);
87
+
88
+ always @(posedge HCLK or negedge HRESETn)
89
+ begin
90
+ if (~HRESETn)
91
+ db_reg <= 4'h0;
92
+ else if (db_reg_select)
93
+ db_reg <= HWDATA;
94
+ end
95
+
96
+ assign HRDATA =
97
+ (IOADDR[23:2] == 22'h0) ? {28'd0,db_reg} :
98
+ 32'hDEADBEEF;
99
+ assign HREADYOUT = 1'b1; // Always ready
100
+
101
+ endmodule
chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/AHBlite_sys_0.v ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ `timescale 1ns/1ns
3
+
4
+ //`define DBG
5
+ module AHBlite_sys_0(
6
+ `ifdef USE_POWER_PINS
7
+ input VPWR,
8
+ input VGND,
9
+ `endif
10
+ input HCLK,
11
+ input HRESETn,
12
+
13
+ input [31: 0] HADDR,
14
+ input [31: 0] HWDATA,
15
+ input HWRITE,
16
+ input [1: 0] HTRANS,
17
+ input [2:0] HSIZE,
18
+
19
+ output HREADY,
20
+ output [31: 0] HRDATA,
21
+
22
+ input wire [3: 0] fdi_S0,
23
+ output wire [3: 0] fdo_S0,
24
+ output wire [0: 0] fdoe_S0,
25
+ output wire [0: 0] fsclk_S0,
26
+ output wire [0: 0] fcen_S0,
27
+ input wire [31: 0] SRAMRDATA_S1,
28
+ output wire [3: 0] SRAMWEN_S1,
29
+ output wire [31: 0] SRAMWDATA_S1,
30
+ output wire [0: 0] SRAMCS0_S1,
31
+ //output wire [0: 0] SRAMCS1_S1,
32
+ //output wire [0: 0] SRAMCS2_S1,
33
+ //output wire [0: 0] SRAMCS3_S1,
34
+ output wire [11: 0] SRAMADDR_S1,
35
+ input wire [15: 0] GPIOIN_S2,
36
+ output wire [15: 0] GPIOOUT_S2,
37
+ output wire [15: 0] GPIOPU_S2,
38
+ output wire [15: 0] GPIOPD_S2,
39
+ output wire [15: 0] GPIOOEN_S2,
40
+ output wire [3:0] db_reg,
41
+ input wire [0: 0] RsRx_SS0_S0,
42
+ output wire [0: 0] RsTx_SS0_S0,
43
+ output wire [0: 0] uart_irq_SS0_S0,
44
+ input wire [0: 0] RsRx_SS0_S1,
45
+ output wire [0: 0] RsTx_SS0_S1,
46
+ output wire [0: 0] uart_irq_SS0_S1,
47
+ input wire [0: 0] MSI_SS0_S2,
48
+ output wire [0: 0] MSO_SS0_S2,
49
+ output wire [0: 0] SSn_SS0_S2,
50
+ output wire [0: 0] SCLK_SS0_S2,
51
+ input wire [0: 0] MSI_SS0_S3,
52
+ output wire [0: 0] MSO_SS0_S3,
53
+ output wire [0: 0] SSn_SS0_S3,
54
+ output wire [0: 0] SCLK_SS0_S3,
55
+ input wire [0: 0] scl_i_SS0_S4,
56
+ output wire [0: 0] scl_o_SS0_S4,
57
+ output wire [0: 0] scl_oen_o_SS0_S4,
58
+ input wire [0: 0] sda_i_SS0_S4,
59
+ output wire [0: 0] sda_o_SS0_S4,
60
+ output wire [0: 0] sda_oen_o_SS0_S4,
61
+ input wire [0: 0] scl_i_SS0_S5,
62
+ output wire [0: 0] scl_o_SS0_S5,
63
+ output wire [0: 0] scl_oen_o_SS0_S5,
64
+ input wire [0: 0] sda_i_SS0_S5,
65
+ output wire [0: 0] sda_o_SS0_S5,
66
+ output wire [0: 0] sda_oen_o_SS0_S5,
67
+ output wire [0: 0] pwm_SS0_S6,
68
+ output wire [0: 0] pwm_SS0_S7,
69
+
70
+ output wire [31:0] IRQ
71
+ );
72
+
73
+ //assign IRQ[15:0] = 0;
74
+
75
+ //Inputs
76
+ wire HSEL_S0, HSEL_S1, HSEL_S2, HSEL_S3, HSEL_S4, HSEL_SS0;
77
+
78
+ //Outputs
79
+ wire [31:0] HRDATA_S0, HRDATA_S1, HRDATA_S2, HRDATA_S3, HRDATA_S4, HRDATA_SS0, HRDATA;
80
+ wire HREADY_S0, HREADY_S1, HREADY_S2, HREADY_S3, HREADY_S4, HREADY_SS0, HREADY;
81
+ wire [1:0] HRESP;
82
+ // wire IRQ;
83
+
84
+ wire [15: 0] WGPIODIN_S2;
85
+ wire [15: 0] WGPIODOUT_S2;
86
+ wire [15: 0] WGPIOPU_S2;
87
+ wire [15: 0] WGPIOPD_S2;
88
+ wire [15: 0] WGPIODIR_S2;
89
+
90
+ //Digital module # 0
91
+ QSPI_XIP_CTRL S0 (
92
+ `ifdef USE_POWER_PINS
93
+ .VPWR(VPWR),
94
+ .VGND(VGND),
95
+ `endif
96
+ .HCLK(HCLK),
97
+ .HRESETn(HRESETn),
98
+ .HSEL(HSEL_S0),
99
+ .HADDR(HADDR),
100
+ .HREADY(HREADY),
101
+ .HWRITE(HWRITE),
102
+ .HTRANS(HTRANS),
103
+ //.HSIZE(HSIZE),
104
+ .HRDATA(HRDATA_S0),
105
+ .HREADYOUT(HREADY_S0),
106
+ .din(fdi_S0),
107
+ .dout(fdo_S0),
108
+ .douten(fdoe_S0),
109
+ .sck(fsclk_S0),
110
+ .ce_n(fcen_S0)
111
+ );
112
+
113
+
114
+ //Digital module # 1
115
+ AHBSRAM S1 (
116
+ .HCLK(HCLK),
117
+ .HRESETn(HRESETn),
118
+ .HSEL(HSEL_S1),
119
+ .HADDR(HADDR),
120
+ .HREADY(HREADY),
121
+ .HWRITE(HWRITE),
122
+ .HTRANS(HTRANS),
123
+ .HSIZE(HSIZE),
124
+ .HWDATA(HWDATA),
125
+ .HRDATA(HRDATA_S1),
126
+ .HREADYOUT(HREADY_S1),
127
+ .SRAMRDATA(SRAMRDATA_S1),
128
+ .SRAMWEN(SRAMWEN_S1),
129
+ .SRAMWDATA(SRAMWDATA_S1),
130
+ .SRAMCS0(SRAMCS0_S1),
131
+ //.SRAMCS1(SRAMCS1_S1),
132
+ //.SRAMCS2(SRAMCS2_S1),
133
+ //.SRAMCS3(SRAMCS3_S1),
134
+ .SRAMADDR(SRAMADDR_S1)
135
+ );
136
+
137
+ //Digital module # 2
138
+ GPIO S2 (
139
+ .WGPIODIN(WGPIODIN_S2),
140
+ .WGPIODOUT(WGPIODOUT_S2),
141
+ .WGPIOPU(WGPIOPU_S2),
142
+ .WGPIOPD(WGPIOPD_S2),
143
+ .WGPIODIR(WGPIODIR_S2),
144
+ .GPIOIN(GPIOIN_S2),
145
+ .GPIOOUT(GPIOOUT_S2),
146
+ .GPIOPU(GPIOPU_S2),
147
+ .GPIOPD(GPIOPD_S2),
148
+ .GPIOOEN(GPIOOEN_S2)
149
+ );
150
+
151
+ //AHB Slave # 2
152
+ AHBlite_GPIO S_2 (
153
+ .HCLK(HCLK),
154
+ .HRESETn(HRESETn),
155
+ .HSEL(HSEL_S2),
156
+ .HADDR(HADDR[23:2]),
157
+ .HREADY(HREADY),
158
+ .HWRITE(HWRITE),
159
+ .HTRANS(HTRANS),
160
+ .HSIZE(HSIZE),
161
+ .HWDATA(HWDATA),
162
+
163
+ .WGPIODIN(WGPIODIN_S2),
164
+ .WGPIODOUT(WGPIODOUT_S2),
165
+ .WGPIOPU(WGPIOPU_S2),
166
+ .WGPIOPD(WGPIOPD_S2),
167
+ .WGPIODIR(WGPIODIR_S2),
168
+ .HRDATA(HRDATA_S2),
169
+ .HREADYOUT(HREADY_S2),
170
+ .HRESP(HRESP),
171
+
172
+ .IRQ(IRQ[15:0])
173
+ );
174
+
175
+ //AHB Slave # 3
176
+ /*
177
+ AHBlite_db_reg S_3 (
178
+ .HCLK(HCLK),
179
+ .HRESETn(HRESETn),
180
+ .HSEL(HSEL_S3),
181
+ .HADDR(HADDR[23:2]),
182
+ .HREADY(HREADY),
183
+ .HWRITE(HWRITE),
184
+ .HTRANS(HTRANS),
185
+ .HSIZE(HSIZE),
186
+ .HWDATA(HWDATA),
187
+ .db_reg(db_reg),
188
+
189
+ .HRDATA(HRDATA_S3),
190
+ .HREADYOUT(HREADY_S3),
191
+ .HRESP(HRESP)
192
+ );
193
+ */
194
+
195
+ AHB_SPM S_3 (
196
+ .HCLK(HCLK),
197
+ .HRESETn(HRESETn),
198
+ .HSEL(HSEL_S3),
199
+ .HADDR(HADDR),
200
+ .HREADY(HREADY),
201
+ .HWRITE(HWRITE),
202
+ .HTRANS(HTRANS),
203
+ .HSIZE(HSIZE),
204
+ .HWDATA(HWDATA),
205
+ //.db_reg(db_reg),
206
+
207
+ .HRDATA(HRDATA_S3),
208
+ .HREADYOUT(HREADY_S3),
209
+ .HRESP(HRESP)
210
+ );
211
+
212
+
213
+ // SLAVE 4
214
+ assign HREADY_S4 = 1;
215
+
216
+
217
+ //AHB Bus
218
+ AHBlite_BUS0 AHB(
219
+ .HCLK(HCLK),
220
+ .HRESETn(HRESETn),
221
+
222
+ // Master Interface
223
+ .HADDR(HADDR),
224
+ .HWDATA(HWDATA),
225
+ .HREADY(HREADY),
226
+ .HRDATA(HRDATA),
227
+
228
+ // Slave # 0
229
+ .HSEL_S0(HSEL_S0),
230
+ .HREADY_S0(HREADY_S0),
231
+ .HRDATA_S0(HRDATA_S0),
232
+
233
+ // Slave # 1
234
+ .HSEL_S1(HSEL_S1),
235
+ .HREADY_S1(HREADY_S1),
236
+ .HRDATA_S1(HRDATA_S1),
237
+
238
+ // Slave # 2
239
+ .HSEL_S2(HSEL_S2),
240
+ .HREADY_S2(HREADY_S2),
241
+ .HRDATA_S2(HRDATA_S2),
242
+
243
+ // Slave # 3
244
+ .HSEL_S3(HSEL_S3),
245
+ .HREADY_S3(HREADY_S3),
246
+ .HRDATA_S3(HRDATA_S3),
247
+
248
+ // Slave # 4
249
+ .HSEL_S4(HSEL_S4),
250
+ .HREADY_S4(HREADY_S4),
251
+ .HRDATA_S4(HRDATA_S4),
252
+
253
+ // Subsystem # 0
254
+ .HSEL_SS0(HSEL_SS0),
255
+ .HREADY_SS0(HREADY_SS0),
256
+ .HRDATA_SS0(HRDATA_SS0)
257
+ );
258
+
259
+ //SubSystem Instantiation #0
260
+ apb_sys_0 apb_sys_inst_0(
261
+ `ifdef USE_POWER_PINS
262
+ .VPWR(VPWR),
263
+ .VGND(VGND),
264
+ `endif
265
+ // Global signals
266
+ .HCLK(HCLK),
267
+ .HRESETn(HRESETn),
268
+
269
+ // AHB Slave inputs
270
+ .HADDR(HADDR),
271
+ .HTRANS(HTRANS),
272
+ .HWRITE(HWRITE),
273
+ .HWDATA(HWDATA),
274
+ .HSEL(HSEL_SS0),
275
+ .HREADY(HREADY),
276
+
277
+ // AHB Slave outputs
278
+ .HRDATA(HRDATA_SS0),
279
+ .HREADYOUT(HREADY_SS0),
280
+ .RsRx_S0(RsRx_SS0_S0),
281
+ .RsTx_S0(RsTx_SS0_S0),
282
+
283
+ .RsRx_S1(RsRx_SS0_S1),
284
+ .RsTx_S1(RsTx_SS0_S1),
285
+
286
+ .MSI_S2(MSI_SS0_S2),
287
+ .MSO_S2(MSO_SS0_S2),
288
+ .SSn_S2(SSn_SS0_S2),
289
+ .SCLK_S2(SCLK_SS0_S2),
290
+
291
+ .MSI_S3(MSI_SS0_S3),
292
+ .MSO_S3(MSO_SS0_S3),
293
+ .SSn_S3(SSn_SS0_S3),
294
+ .SCLK_S3(SCLK_SS0_S3),
295
+
296
+ .scl_i_S4(scl_i_SS0_S4),
297
+ .scl_o_S4(scl_o_SS0_S4),
298
+ .scl_oen_o_S4(scl_oen_o_SS0_S4),
299
+ .sda_i_S4(sda_i_SS0_S4),
300
+ .sda_o_S4(sda_o_SS0_S4),
301
+ .sda_oen_o_S4(sda_oen_o_SS0_S4),
302
+
303
+ .scl_i_S5(scl_i_SS0_S5),
304
+ .scl_o_S5(scl_o_SS0_S5),
305
+ .scl_oen_o_S5(scl_oen_o_SS0_S5),
306
+ .sda_i_S5(sda_i_SS0_S5),
307
+ .sda_o_S5(sda_o_SS0_S5),
308
+ .sda_oen_o_S5(sda_oen_o_SS0_S5),
309
+
310
+ .pwm_S6(pwm_SS0_S6),
311
+ .pwm_S7(pwm_SS0_S7),
312
+
313
+ .IRQ(IRQ[31:16])
314
+ );
315
+ `ifdef DBG
316
+ always @(posedge HCLK)
317
+ if(HTRANS[1] & HREADY)
318
+ $display("Mem request (%d) A:%X", HWRITE, HADDR);
319
+ `endif
320
+ endmodule
321
+
chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/APB_sys_0/AHB_2_APB.v ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ `timescale 1ns/1ns
3
+ module ahb_2_apb(
4
+ // Global signals --------------------------------------------------------------
5
+ input wire HCLK,
6
+ input wire HRESETn,
7
+
8
+ // AHB Slave inputs ------------------------------------------------------------
9
+ input wire [31:0] HADDR,
10
+ input wire [1:0] HTRANS,
11
+ input wire HWRITE,
12
+ input wire [31:0] HWDATA,
13
+ input wire HSEL,
14
+ input wire HREADY,
15
+
16
+ // APB Master inputs -----------------------------------------------------------
17
+ input wire [31:0] PRDATA,
18
+ input wire PREADY,
19
+
20
+ // AHB Slave outputs -----------------------------------------------------------
21
+ output wire [31:0] HRDATA,
22
+ output reg HREADYOUT,
23
+
24
+ // APB Master outputs ----------------------------------------------------------
25
+ output wire [31:0] PWDATA,
26
+ output reg PENABLE,
27
+ output reg [31:0] PADDR,
28
+ output reg PWRITE,
29
+
30
+ output wire PCLK,
31
+ output wire PRESETn
32
+ );
33
+
34
+ //Constants
35
+
36
+ `define ST_IDLE 2'b00
37
+ `define ST_SETUP 2'b01
38
+ `define ST_ACCESS 2'b11
39
+
40
+
41
+ wire Transfer;
42
+ wire ACRegEn;
43
+ reg [31:0] last_HADDR;
44
+ reg last_HWRITE;
45
+
46
+ wire [31:0] HADDR_Mux;
47
+
48
+ reg [1:0] CurrentState;
49
+ reg [1:0] NextState;
50
+
51
+ reg HREADY_next;
52
+ wire PWRITE_next;
53
+ wire PENABLE_next;
54
+ wire APBEn;
55
+
56
+
57
+ assign PCLK = HCLK;
58
+ assign PRESETn = HRESETn;
59
+
60
+ assign Transfer = HSEL & HREADY & HTRANS[1];
61
+
62
+ assign ACRegEn = HSEL & HREADY;
63
+
64
+ //Set register values of AHB signals
65
+
66
+ always @ (posedge HCLK, negedge HRESETn)
67
+ begin
68
+ if(!HRESETn)
69
+ begin
70
+ last_HADDR <= {32{1'b0}};
71
+ last_HWRITE <= 1'b0;
72
+ end
73
+
74
+ else
75
+ begin
76
+ if(ACRegEn)
77
+ begin
78
+ last_HADDR <= HADDR;
79
+ last_HWRITE <= HWRITE;
80
+ end
81
+ end
82
+ end
83
+
84
+
85
+ // Next State Logic
86
+
87
+ always @ (CurrentState,PREADY, Transfer)
88
+ begin
89
+ case (CurrentState)
90
+ `ST_IDLE:
91
+ begin
92
+ if(Transfer)
93
+ NextState = `ST_SETUP;
94
+ else
95
+ NextState = `ST_IDLE;
96
+ end
97
+
98
+ `ST_SETUP:
99
+ begin
100
+ NextState = `ST_ACCESS;
101
+ end
102
+
103
+ `ST_ACCESS:
104
+ begin
105
+ if(!PREADY)
106
+ NextState = `ST_ACCESS;
107
+ else
108
+ begin
109
+ if(Transfer)
110
+ NextState = `ST_SETUP;
111
+ else
112
+ NextState = `ST_IDLE;
113
+ end
114
+ end
115
+ default:
116
+ NextState = `ST_IDLE;
117
+ endcase
118
+ end
119
+
120
+ // State Machine
121
+
122
+ always @ (posedge HCLK, negedge HRESETn)
123
+ begin
124
+ if(!HRESETn)
125
+ CurrentState <= `ST_IDLE;
126
+ else
127
+ CurrentState <= NextState;
128
+ end
129
+
130
+
131
+ //HREADYOUT
132
+
133
+ always @ (NextState, PREADY)
134
+ begin
135
+ case (NextState)
136
+ `ST_IDLE:
137
+ HREADY_next = 1'b1;
138
+ `ST_SETUP:
139
+ HREADY_next = 1'b0;
140
+ `ST_ACCESS:
141
+ HREADY_next = PREADY;
142
+ default:
143
+ HREADY_next = 1'b1;
144
+ endcase
145
+ end
146
+
147
+ always @(posedge HCLK, negedge HRESETn)
148
+ begin
149
+ if(!HRESETn)
150
+ HREADYOUT <= 1'b1;
151
+ else
152
+ HREADYOUT <= HREADY_next;
153
+ end
154
+
155
+
156
+ // HADDRMux
157
+ assign HADDR_Mux = ((NextState == `ST_SETUP) ? HADDR :
158
+ last_HADDR);
159
+
160
+ //APBen
161
+ assign APBEn = ((NextState == `ST_SETUP) ? 1'b1 : 1'b0);
162
+
163
+ //PADDR
164
+
165
+ always @ (posedge HCLK, negedge HRESETn)
166
+ begin
167
+ if (!HRESETn)
168
+ PADDR <= {31{1'b0}};
169
+ else
170
+ begin
171
+ if (APBEn)
172
+ PADDR <= HADDR_Mux;
173
+ end
174
+ end
175
+
176
+ //PWDATA
177
+
178
+ assign PWDATA = HWDATA;
179
+
180
+
181
+ //PENABLE
182
+
183
+ assign PENABLE_next = ((NextState == `ST_ACCESS) ? 1'b1 : 1'b0);
184
+
185
+ always @ (posedge HCLK, negedge HRESETn)
186
+ begin
187
+ if(!HRESETn)
188
+ PENABLE <= 1'b0;
189
+ else
190
+ PENABLE <= PENABLE_next;
191
+ end
192
+
193
+ //PWRITE
194
+
195
+ assign PWRITE_next = ((NextState == `ST_SETUP) ? HWRITE : last_HWRITE);
196
+
197
+ always @ (posedge HCLK, negedge HRESETn)
198
+ begin
199
+ if(!HRESETn)
200
+ PWRITE <= 1'b0;
201
+ else
202
+ begin
203
+ if (APBEn)
204
+ PWRITE <= PWRITE_next;
205
+ end
206
+ end
207
+
208
+
209
+ //HRDATA
210
+ assign HRDATA = PRDATA;
211
+
212
+
213
+
214
+ endmodule
chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/APB_sys_0/APB_PWM32.v ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ APB Wrapper for PWM32 macro
3
+ Automatically generated from a JSON description by Mohamed Shalan
4
+ Generated at 2020-11-26 12:31:7
5
+ */
6
+
7
+ `timescale 1ns/1ns
8
+
9
+ module APB_PWM32 (
10
+ // APB Interface
11
+ // clock and reset
12
+ input wire PCLK,
13
+ //input wire PCLKG, // Gated clock
14
+ input wire PRESETn, // Reset
15
+
16
+ // input ports
17
+ input wire PSEL, // Select
18
+ input wire [19:2] PADDR, // Address
19
+ input wire PENABLE, // Transfer control
20
+ input wire PWRITE, // Write control
21
+ input wire [31:0] PWDATA, // Write data
22
+
23
+ // output ports
24
+ output wire [31:0] PRDATA, // Read data
25
+ output wire PREADY,
26
+ // Device ready
27
+
28
+ // IP Interface
29
+ // PRE register/fields
30
+ output [31:0] PRE,
31
+
32
+
33
+ // TMRCMP1 register/fields
34
+ output [31:0] TMRCMP1,
35
+
36
+
37
+ // TMRCMP2 register/fields
38
+ output [31:0] TMRCMP2,
39
+
40
+
41
+ // TMREN register/fields
42
+ output [0:0] TMREN
43
+
44
+ );
45
+ wire rd_enable;
46
+ wire wr_enable;
47
+ assign rd_enable = PSEL & (~PWRITE);
48
+ assign wr_enable = PSEL & PWRITE & (PENABLE);
49
+ assign PREADY = 1'b1;
50
+
51
+
52
+ reg [31:0] PRE;
53
+
54
+ reg [31:0] TMRCMP1;
55
+
56
+ reg [31:0] TMRCMP2;
57
+
58
+ reg [0:0] TMREN;
59
+
60
+
61
+ // Register: PRE
62
+ wire PRE_select = wr_enable & (PADDR[19:2] == 18'h4);
63
+
64
+ always @(posedge PCLK or negedge PRESETn)
65
+ begin
66
+ if (~PRESETn)
67
+ PRE <= 32'h0;
68
+ else if (PRE_select)
69
+ PRE <= PWDATA;
70
+ end
71
+
72
+ // Register: TMRCMP1
73
+ wire TMRCMP1_select = wr_enable & (PADDR[19:2] == 18'h1);
74
+
75
+ always @(posedge PCLK or negedge PRESETn)
76
+ begin
77
+ if (~PRESETn)
78
+ TMRCMP1 <= 32'h0;
79
+ else if (TMRCMP1_select)
80
+ TMRCMP1 <= PWDATA;
81
+ end
82
+
83
+ // Register: TMRCMP2
84
+ wire TMRCMP2_select = wr_enable & (PADDR[19:2] == 18'h2);
85
+
86
+ always @(posedge PCLK or negedge PRESETn)
87
+ begin
88
+ if (~PRESETn)
89
+ TMRCMP2 <= 32'h0;
90
+ else if (TMRCMP2_select)
91
+ TMRCMP2 <= PWDATA;
92
+ end
93
+
94
+ // Register: TMREN
95
+ wire TMREN_select = wr_enable & (PADDR[19:2] == 18'h8);
96
+
97
+ always @(posedge PCLK or negedge PRESETn)
98
+ begin
99
+ if (~PRESETn)
100
+ TMREN <= 1'h0;
101
+ else if (TMREN_select)
102
+ TMREN <= PWDATA;
103
+ end
104
+
105
+ assign PRDATA =
106
+ (PADDR[19:2] == 18'h4) ? PRE :
107
+ (PADDR[19:2] == 18'h1) ? TMRCMP1 :
108
+ (PADDR[19:2] == 18'h2) ? TMRCMP2 :
109
+ (PADDR[19:2] == 18'h8) ? {31'd0,TMREN} :
110
+ 32'hDEADBEEF;
111
+
112
+ endmodule
chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/APB_sys_0/APB_TIMER32.v ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ APB Wrapper for TIMER32 macro
3
+ Automatically generated from a JSON description by Mohamed Shalan
4
+ Generated at 2020-11-26 12:31:7
5
+ */
6
+
7
+ `timescale 1ns/1ns
8
+
9
+ module APB_TIMER32 (
10
+ // APB Interface
11
+ // clock and reset
12
+ input wire PCLK,
13
+ //input wire PCLKG, // Gated clock
14
+ input wire PRESETn, // Reset
15
+
16
+ // input ports
17
+ input wire PSEL, // Select
18
+ input wire [19:2] PADDR, // Address
19
+ input wire PENABLE, // Transfer control
20
+ input wire PWRITE, // Write control
21
+ input wire [31:0] PWDATA, // Write data
22
+
23
+ // output ports
24
+ output wire [31:0] PRDATA, // Read data
25
+ output wire PREADY,
26
+ // Device ready
27
+
28
+ // IP Interface
29
+ output IRQ,
30
+
31
+ // TMR register/fields
32
+ input [31:0] TMR,
33
+
34
+
35
+ // PRE register/fields
36
+ output [31:0] PRE,
37
+
38
+
39
+ // TMRCMP register/fields
40
+ output [31:0] TMRCMP,
41
+
42
+
43
+ // TMROV register/fields
44
+ input [0:0] TMROV,
45
+
46
+
47
+ // TMROVCLR register/fields
48
+ output [0:0] TMROVCLR,
49
+
50
+
51
+ // TMREN register/fields
52
+ output [0:0] TMREN
53
+
54
+ );
55
+ wire rd_enable;
56
+ wire wr_enable;
57
+ assign rd_enable = PSEL & (~PWRITE);
58
+ assign wr_enable = PSEL & PWRITE & (PENABLE);
59
+ assign PREADY = 1'b1;
60
+
61
+
62
+ reg [31:0] PRE;
63
+
64
+ reg [31:0] TMRCMP;
65
+
66
+ reg [0:0] TMROVCLR;
67
+
68
+ reg [0:0] TMREN;
69
+
70
+ wire[31:0] TMR;
71
+ wire[0:0] TMROV;
72
+
73
+ // Register: PRE
74
+ wire PRE_select = wr_enable & (PADDR[19:2] == 18'h1);
75
+
76
+ always @(posedge PCLK or negedge PRESETn)
77
+ begin
78
+ if (~PRESETn)
79
+ PRE <= 32'h0;
80
+ else if (PRE_select)
81
+ PRE <= PWDATA;
82
+ end
83
+
84
+ // Register: TMRCMP
85
+ wire TMRCMP_select = wr_enable & (PADDR[19:2] == 18'h2);
86
+
87
+ always @(posedge PCLK or negedge PRESETn)
88
+ begin
89
+ if (~PRESETn)
90
+ TMRCMP <= 32'h0;
91
+ else if (TMRCMP_select)
92
+ TMRCMP <= PWDATA;
93
+ end
94
+
95
+ // Register: TMROVCLR
96
+ wire TMROVCLR_select = wr_enable & (PADDR[19:2] == 18'h4);
97
+
98
+ always @(posedge PCLK or negedge PRESETn)
99
+ begin
100
+ if (~PRESETn)
101
+ TMROVCLR <= 1'h0;
102
+ else if (TMROVCLR_select)
103
+ TMROVCLR <= PWDATA;
104
+ end
105
+
106
+ // Register: TMREN
107
+ wire TMREN_select = wr_enable & (PADDR[19:2] == 18'h5);
108
+
109
+ always @(posedge PCLK or negedge PRESETn)
110
+ begin
111
+ if (~PRESETn)
112
+ TMREN <= 1'h0;
113
+ else if (TMREN_select)
114
+ TMREN <= PWDATA;
115
+ end
116
+
117
+
118
+ // IRQ Enable Register @ offset 0x100
119
+ reg[0:0] IRQEN;
120
+ wire IRQEN_select = wr_enable & (PADDR[19:2] == 18'h40);
121
+
122
+ always @(posedge PCLK or negedge PRESETn)
123
+ begin
124
+ if (~PRESETn)
125
+ IRQEN <= 1'h0;
126
+ else if (IRQEN_select)
127
+ IRQEN <= PWDATA;
128
+ end
129
+
130
+ assign IRQ = ( TMROV & IRQEN[0] ) ;
131
+
132
+ assign PRDATA =
133
+ (PADDR[19:2] == 18'h0) ? TMR :
134
+ (PADDR[19:2] == 18'h1) ? PRE :
135
+ (PADDR[19:2] == 18'h2) ? TMRCMP :
136
+ (PADDR[19:2] == 18'h3) ? {31'd0,TMROV} :
137
+ (PADDR[19:2] == 18'h4) ? {31'd0,TMROVCLR} :
138
+ (PADDR[19:2] == 18'h5) ? {31'd0,TMREN} :
139
+ (PADDR[19:2] == 18'h40) ? {31'd0,IRQEN} :
140
+ 32'hDEADBEEF;
141
+
142
+ endmodule
chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/APB_sys_0/APB_WDT32.v ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ APB Wrapper for WDT32 macro
3
+ Automatically generated from a JSON description by Mohamed Shalan
4
+ Generated at 2020-11-26 12:31:7
5
+ */
6
+
7
+ `timescale 1ns/1ns
8
+
9
+ module APB_WDT32 (
10
+ // APB Interface
11
+ // clock and reset
12
+ input wire PCLK,
13
+ //input wire PCLKG, // Gated clock
14
+ input wire PRESETn, // Reset
15
+
16
+ // input ports
17
+ input wire PSEL, // Select
18
+ input wire [19:2] PADDR, // Address
19
+ input wire PENABLE, // Transfer control
20
+ input wire PWRITE, // Write control
21
+ input wire [31:0] PWDATA, // Write data
22
+
23
+ // output ports
24
+ output wire [31:0] PRDATA, // Read data
25
+ output wire PREADY,
26
+ // Device ready
27
+
28
+ // IP Interface
29
+ output IRQ,
30
+
31
+ // WDTMR register/fields
32
+ input [31:0] WDTMR,
33
+
34
+
35
+ // WDLOAD register/fields
36
+ output [31:0] WDLOAD,
37
+
38
+
39
+ // WDOV register/fields
40
+ input [0:0] WDOV,
41
+
42
+
43
+ // WDOVCLR register/fields
44
+ output [0:0] WDOVCLR,
45
+
46
+
47
+ // WDEN register/fields
48
+ output [0:0] WDEN
49
+
50
+ );
51
+ wire rd_enable;
52
+ wire wr_enable;
53
+ assign rd_enable = PSEL & (~PWRITE);
54
+ assign wr_enable = PSEL & PWRITE & (PENABLE);
55
+ assign PREADY = 1'b1;
56
+
57
+
58
+ reg [31:0] WDLOAD;
59
+
60
+ reg [0:0] WDOVCLR;
61
+
62
+ reg [0:0] WDEN;
63
+
64
+ wire[31:0] WDTMR;
65
+ wire[0:0] WDOV;
66
+
67
+ // Register: WDLOAD
68
+ wire WDLOAD_select = wr_enable & (PADDR[19:2] == 18'h1);
69
+
70
+ always @(posedge PCLK or negedge PRESETn)
71
+ begin
72
+ if (~PRESETn)
73
+ WDLOAD <= 32'h0;
74
+ else if (WDLOAD_select)
75
+ WDLOAD <= PWDATA;
76
+ end
77
+
78
+ // Register: WDOVCLR
79
+ wire WDOVCLR_select = wr_enable & (PADDR[19:2] == 18'h4);
80
+
81
+ always @(posedge PCLK or negedge PRESETn)
82
+ begin
83
+ if (~PRESETn)
84
+ WDOVCLR <= 1'h0;
85
+ else if (WDOVCLR_select)
86
+ WDOVCLR <= PWDATA;
87
+ end
88
+
89
+ // Register: WDEN
90
+ wire WDEN_select = wr_enable & (PADDR[19:2] == 18'h5);
91
+
92
+ always @(posedge PCLK or negedge PRESETn)
93
+ begin
94
+ if (~PRESETn)
95
+ WDEN <= 1'h0;
96
+ else if (WDEN_select)
97
+ WDEN <= PWDATA;
98
+ end
99
+
100
+
101
+ // IRQ Enable Register @ offset 0x100
102
+ reg[0:0] IRQEN;
103
+ wire IRQEN_select = wr_enable & (PADDR[19:2] == 18'h40);
104
+
105
+ always @(posedge PCLK or negedge PRESETn)
106
+ begin
107
+ if (~PRESETn)
108
+ IRQEN <= 1'h0;
109
+ else if (IRQEN_select)
110
+ IRQEN <= PWDATA;
111
+ end
112
+
113
+ assign IRQ = ( WDOV & IRQEN[0] ) ;
114
+
115
+ assign PRDATA =
116
+ (PADDR[19:2] == 18'h0) ? WDTMR :
117
+ (PADDR[19:2] == 18'h1) ? WDLOAD :
118
+ (PADDR[19:2] == 18'h3) ? {31'd0,WDOV} :
119
+ (PADDR[19:2] == 18'h4) ? {31'd0,WDOVCLR} :
120
+ (PADDR[19:2] == 18'h5) ? {31'd0,WDEN} :
121
+ (PADDR[19:2] == 18'h40) ? {31'd0,IRQEN} :
122
+ 32'hDEADBEEF;
123
+
124
+ endmodule
chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/APB_sys_0/APB_bus0.v ADDED
@@ -0,0 +1,236 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ `timescale 1ns/1ns
3
+
4
+ module APB_BUS0 #(
5
+ // Parameters to enable/disable ports
6
+
7
+ parameter PORT0_ENABLE = 1,
8
+ parameter PORT1_ENABLE = 1,
9
+ parameter PORT2_ENABLE = 1,
10
+ parameter PORT3_ENABLE = 1,
11
+ parameter PORT4_ENABLE = 1,
12
+ parameter PORT5_ENABLE = 1,
13
+ parameter PORT6_ENABLE = 1,
14
+ parameter PORT7_ENABLE = 1,
15
+ parameter PORT8_ENABLE = 1,
16
+ parameter PORT9_ENABLE = 1,
17
+ parameter PORT10_ENABLE = 1,
18
+ parameter PORT11_ENABLE = 1,
19
+ parameter PORT12_ENABLE = 1,
20
+ parameter PORT13_ENABLE = 1,
21
+ parameter PORT14_ENABLE = 1,
22
+ parameter PORT15_ENABLE = 1
23
+ )
24
+
25
+
26
+ (
27
+ // --------------------------------------------------------------------------
28
+ // Port Definitions
29
+ // --------------------------------------------------------------------------
30
+ //MODULE INPUTS
31
+ input wire [3:0] DEC_BITS,
32
+ input wire PSEL,
33
+
34
+ // Slave # 0
35
+ output wire PSEL_S0,
36
+ input wire PREADY_S0,
37
+ input wire [31:0] PRDATA_S0,
38
+ input wire PSLVERR_S0,
39
+ // Slave # 1
40
+ output wire PSEL_S1,
41
+ input wire PREADY_S1,
42
+ input wire [31:0] PRDATA_S1,
43
+ input wire PSLVERR_S1,
44
+ // Slave # 2
45
+ output wire PSEL_S2,
46
+ input wire PREADY_S2,
47
+ input wire [31:0] PRDATA_S2,
48
+ input wire PSLVERR_S2,
49
+ // Slave # 3
50
+ output wire PSEL_S3,
51
+ input wire PREADY_S3,
52
+ input wire [31:0] PRDATA_S3,
53
+ input wire PSLVERR_S3,
54
+ // Slave # 4
55
+ output wire PSEL_S4,
56
+ input wire PREADY_S4,
57
+ input wire [31:0] PRDATA_S4,
58
+ input wire PSLVERR_S4,
59
+ // Slave # 5
60
+ output wire PSEL_S5,
61
+ input wire PREADY_S5,
62
+ input wire [31:0] PRDATA_S5,
63
+ input wire PSLVERR_S5,
64
+ // Slave # 6
65
+ output wire PSEL_S6,
66
+ input wire PREADY_S6,
67
+ input wire [31:0] PRDATA_S6,
68
+ input wire PSLVERR_S6,
69
+ // Slave # 7
70
+ output wire PSEL_S7,
71
+ input wire PREADY_S7,
72
+ input wire [31:0] PRDATA_S7,
73
+ input wire PSLVERR_S7,
74
+ // Slave # 8
75
+ output wire PSEL_S8,
76
+ input wire PREADY_S8,
77
+ input wire [31:0] PRDATA_S8,
78
+ input wire PSLVERR_S8,
79
+ // Slave # 9
80
+ output wire PSEL_S9,
81
+ input wire PREADY_S9,
82
+ input wire [31:0] PRDATA_S9,
83
+ input wire PSLVERR_S9,
84
+ // Slave # 10
85
+ output wire PSEL_S10,
86
+ input wire PREADY_S10,
87
+ input wire [31:0] PRDATA_S10,
88
+ input wire PSLVERR_S10,
89
+ // Slave # 11
90
+ output wire PSEL_S11,
91
+ input wire PREADY_S11,
92
+ input wire [31:0] PRDATA_S11,
93
+ input wire PSLVERR_S11,
94
+ // Slave # 12
95
+ output wire PSEL_S12,
96
+ input wire PREADY_S12,
97
+ input wire [31:0] PRDATA_S12,
98
+ input wire PSLVERR_S12,
99
+ // Slave # 13
100
+ output wire PSEL_S13,
101
+ input wire PREADY_S13,
102
+ input wire [31:0] PRDATA_S13,
103
+ input wire PSLVERR_S13,
104
+ // Slave # 14
105
+ output wire PSEL_S14,
106
+ input wire PREADY_S14,
107
+ input wire [31:0] PRDATA_S14,
108
+ input wire PSLVERR_S14,
109
+ // Slave # 15
110
+ output wire PSEL_S15,
111
+ input wire PREADY_S15,
112
+ input wire [31:0] PRDATA_S15,
113
+ input wire PSLVERR_S15,
114
+ //MODULE OUTPUTS
115
+ output wire PREADY,
116
+ output wire [31:0] PRDATA,
117
+ output wire PSLVERR
118
+ );
119
+
120
+ wire [15:0] en = {
121
+ (PORT15_ENABLE == 1),
122
+ (PORT14_ENABLE == 1),
123
+ (PORT13_ENABLE == 1),
124
+ (PORT12_ENABLE == 1),
125
+ (PORT11_ENABLE == 1),
126
+ (PORT10_ENABLE == 1),
127
+ (PORT9_ENABLE == 1),
128
+ (PORT8_ENABLE == 1),
129
+ (PORT7_ENABLE == 1),
130
+ (PORT6_ENABLE == 1),
131
+ (PORT5_ENABLE == 1),
132
+ (PORT4_ENABLE == 1),
133
+ (PORT3_ENABLE == 1),
134
+ (PORT2_ENABLE == 1),
135
+ (PORT1_ENABLE == 1),
136
+ (PORT0_ENABLE == 1)
137
+ };
138
+
139
+ wire [15:0] dec = {
140
+ (DEC_BITS == 4'd15),
141
+ (DEC_BITS == 4'd14),
142
+ (DEC_BITS == 4'd13),
143
+ (DEC_BITS == 4'd12),
144
+ (DEC_BITS == 4'd11),
145
+ (DEC_BITS == 4'd10),
146
+ (DEC_BITS == 4'd9),
147
+ (DEC_BITS == 4'd8),
148
+ (DEC_BITS == 4'd7),
149
+ (DEC_BITS == 4'd6),
150
+ (DEC_BITS == 4'd5),
151
+ (DEC_BITS == 4'd4),
152
+ (DEC_BITS == 4'd3),
153
+ (DEC_BITS == 4'd2),
154
+ (DEC_BITS == 4'd1),
155
+ (DEC_BITS == 4'd0)
156
+ };
157
+
158
+
159
+ // Setting PSEL
160
+ assign PSEL_S0 = PSEL & dec[0] & en[0];
161
+ assign PSEL_S1 = PSEL & dec[1] & en[1];
162
+ assign PSEL_S2 = PSEL & dec[2] & en[2];
163
+ assign PSEL_S3 = PSEL & dec[3] & en[3];
164
+ assign PSEL_S4 = PSEL & dec[4] & en[4];
165
+ assign PSEL_S5 = PSEL & dec[5] & en[5];
166
+ assign PSEL_S6 = PSEL & dec[6] & en[6];
167
+ assign PSEL_S7 = PSEL & dec[7] & en[7];
168
+ assign PSEL_S8 = PSEL & dec[8] & en[8];
169
+ assign PSEL_S9 = PSEL & dec[9] & en[9];
170
+ assign PSEL_S10 = PSEL & dec[10] & en[10];
171
+ assign PSEL_S11 = PSEL & dec[11] & en[11];
172
+ assign PSEL_S12 = PSEL & dec[12] & en[12];
173
+ assign PSEL_S13 = PSEL & dec[13] & en[13];
174
+ assign PSEL_S14 = PSEL & dec[14] & en[14];
175
+ assign PSEL_S15 = PSEL & dec[15] & en[15];
176
+
177
+ // Setting PREADY
178
+
179
+ assign PREADY = ~PSEL |
180
+ ( dec[0] & ( PREADY_S0 | en[0] ) ) |
181
+ ( dec[1] & ( PREADY_S1 | en[1] ) ) |
182
+ ( dec[2] & ( PREADY_S2 | en[2] ) ) |
183
+ ( dec[3] & ( PREADY_S3 | en[3] ) ) |
184
+ ( dec[4] & ( PREADY_S4 | en[4] ) ) |
185
+ ( dec[5] & ( PREADY_S5 | en[5] ) ) |
186
+ ( dec[6] & ( PREADY_S6 | en[6] ) ) |
187
+ ( dec[7] & ( PREADY_S7 | en[7] ) ) |
188
+ ( dec[8] & ( PREADY_S8 | en[8] ) ) |
189
+ ( dec[9] & ( PREADY_S9 | en[9] ) ) |
190
+ ( dec[10] & ( PREADY_S10 | en[10] ) ) |
191
+ ( dec[11] & ( PREADY_S11 | en[11] ) ) |
192
+ ( dec[12] & ( PREADY_S12 | en[12] ) ) |
193
+ ( dec[13] & ( PREADY_S13 | en[13] ) ) |
194
+ ( dec[14] & ( PREADY_S14 | en[14] ) ) |
195
+ ( dec[15] & ( PREADY_S15 | en[15] ) );
196
+
197
+ // Setting PSLVERR
198
+
199
+ assign PSLVERR = ( PSEL_S0 & PSLVERR_S0 ) |
200
+ ( PSEL_S1 & PSLVERR_S1 ) |
201
+ ( PSEL_S2 & PSLVERR_S2 ) |
202
+ ( PSEL_S3 & PSLVERR_S3 ) |
203
+ ( PSEL_S4 & PSLVERR_S4 ) |
204
+ ( PSEL_S5 & PSLVERR_S5 ) |
205
+ ( PSEL_S6 & PSLVERR_S6 ) |
206
+ ( PSEL_S7 & PSLVERR_S7 ) |
207
+ ( PSEL_S8 & PSLVERR_S8 ) |
208
+ ( PSEL_S9 & PSLVERR_S9 ) |
209
+ ( PSEL_S10 & PSLVERR_S10 ) |
210
+ ( PSEL_S11 & PSLVERR_S11 ) |
211
+ ( PSEL_S12 & PSLVERR_S12 ) |
212
+ ( PSEL_S13 & PSLVERR_S13 ) |
213
+ ( PSEL_S14 & PSLVERR_S14 ) |
214
+ ( PSEL_S15 & PSLVERR_S15 );
215
+
216
+ // Setting PRDATA
217
+
218
+ assign PRDATA = ( {32{PSEL_S0}} & PRDATA_S0 ) |
219
+ ( {32{PSEL_S1}} & PRDATA_S1 ) |
220
+ ( {32{PSEL_S2}} & PRDATA_S2 ) |
221
+ ( {32{PSEL_S3}} & PRDATA_S3 ) |
222
+ ( {32{PSEL_S4}} & PRDATA_S4 ) |
223
+ ( {32{PSEL_S5}} & PRDATA_S5 ) |
224
+ ( {32{PSEL_S6}} & PRDATA_S6 ) |
225
+ ( {32{PSEL_S7}} & PRDATA_S7 ) |
226
+ ( {32{PSEL_S8}} & PRDATA_S8 ) |
227
+ ( {32{PSEL_S9}} & PRDATA_S9 ) |
228
+ ( {32{PSEL_S10}} & PRDATA_S10 ) |
229
+ ( {32{PSEL_S11}} & PRDATA_S11 ) |
230
+ ( {32{PSEL_S12}} & PRDATA_S12 ) |
231
+ ( {32{PSEL_S13}} & PRDATA_S13 ) |
232
+ ( {32{PSEL_S14}} & PRDATA_S14 ) |
233
+ ( {32{PSEL_S15}} & PRDATA_S15 );
234
+
235
+ endmodule
236
+
chips/openroad_flow_scripts/flow/designs/src/chameleon/AHB_sys_0/APB_sys_0/APB_sys_0.v ADDED
@@ -0,0 +1,760 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ `timescale 1ns/1ns
3
+ (* blackbox *) module apb_sys_0(
4
+ `ifdef USE_POWER_PINS
5
+ input VPWR,
6
+ input VGND,
7
+ `endif
8
+ // Global signals
9
+ input wire HCLK,
10
+ input wire HRESETn,
11
+
12
+ // AHB Slave inputs
13
+ input wire [31:0] HADDR,
14
+ input wire [1:0] HTRANS,
15
+ input wire HWRITE,
16
+ input wire [31:0] HWDATA,
17
+ input wire HSEL,
18
+ input wire HREADY,
19
+
20
+ // AHB Slave outputs
21
+ output wire [31:0] HRDATA,
22
+ output wire HREADYOUT,
23
+ input wire [0: 0] RsRx_S0,
24
+ output wire [0: 0] RsTx_S0,
25
+
26
+ input wire [0: 0] RsRx_S1,
27
+ output wire [0: 0] RsTx_S1,
28
+
29
+ input wire [0: 0] MSI_S2,
30
+ output wire [0: 0] MSO_S2,
31
+ output wire [0: 0] SSn_S2,
32
+ output wire [0: 0] SCLK_S2,
33
+
34
+ input wire [0: 0] MSI_S3,
35
+ output wire [0: 0] MSO_S3,
36
+ output wire [0: 0] SSn_S3,
37
+ output wire [0: 0] SCLK_S3,
38
+
39
+ input wire [0: 0] scl_i_S4,
40
+ output wire [0: 0] scl_o_S4,
41
+ output wire [0: 0] scl_oen_o_S4,
42
+ input wire [0: 0] sda_i_S4,
43
+ output wire [0: 0] sda_o_S4,
44
+ output wire [0: 0] sda_oen_o_S4,
45
+
46
+ input wire [0: 0] scl_i_S5,
47
+ output wire [0: 0] scl_o_S5,
48
+ output wire [0: 0] scl_oen_o_S5,
49
+ input wire [0: 0] sda_i_S5,
50
+ output wire [0: 0] sda_o_S5,
51
+ output wire [0: 0] sda_oen_o_S5,
52
+
53
+ output wire [0: 0] pwm_S6,
54
+ output wire [0: 0] pwm_S7,
55
+
56
+ output [15:0] IRQ
57
+ );
58
+
59
+ // APB Master Signals
60
+ wire PCLK;
61
+ wire PRESETn;
62
+ wire [31:0] PADDR;
63
+ wire PWRITE;
64
+ wire [31:0] PWDATA;
65
+ wire PENABLE;
66
+
67
+ // APB Slave Signals
68
+ wire PREADY;
69
+ wire [31:0] PRDATA ;
70
+ wire PSLVERR;
71
+
72
+ //ADDED PSEL Signal
73
+ //wire PSEL = HSEL;
74
+ wire PSEL_next = HSEL;
75
+ reg PSEL_next_next;
76
+ reg PSEL;
77
+ always @ (posedge HCLK, negedge HRESETn)
78
+ begin
79
+ if(!HRESETn)
80
+ PSEL <= 1'b0;
81
+ else begin
82
+ PSEL_next_next <= PSEL_next;
83
+ PSEL <= PSEL_next | PSEL_next_next;
84
+ end
85
+ end
86
+ //Instantiating the bridge
87
+
88
+ ahb_2_apb AHB2APB_BR (
89
+ .HCLK(HCLK),
90
+ .HRESETn(HRESETn),
91
+ .HADDR(HADDR[31:0]),
92
+ .HSEL(HSEL),
93
+ .HREADY(HREADY),
94
+ .HTRANS(HTRANS[1:0]),
95
+ .HWDATA(HWDATA[31:0]),
96
+ .HWRITE(HWRITE),
97
+ .HRDATA(HRDATA),
98
+ .HREADYOUT(HREADYOUT),
99
+ .PCLK(PCLK),
100
+ .PRESETn(PRESETn),
101
+ .PADDR(PADDR[31:0]),
102
+ .PWRITE(PWRITE),
103
+ .PWDATA(PWDATA[31:0]),
104
+ .PENABLE(PENABLE),
105
+ .PREADY(PREADY),
106
+ .PRDATA(PRDATA[31:0])
107
+ );
108
+
109
+
110
+ //Bus Signals
111
+
112
+ //Slave #0
113
+ wire PSEL_S0;
114
+ wire [31:0] PRDATA_S0;
115
+ wire PREADY_S0;
116
+ wire PSLVERR_S0;
117
+
118
+ //Slave #1
119
+ wire PSEL_S1;
120
+ wire [31:0] PRDATA_S1;
121
+ wire PREADY_S1;
122
+ wire PSLVERR_S1;
123
+
124
+ //Slave #2
125
+ wire PSEL_S2;
126
+ wire [31:0] PRDATA_S2;
127
+ wire PREADY_S2;
128
+ wire PSLVERR_S2;
129
+
130
+ //Slave #3
131
+ wire PSEL_S3;
132
+ wire [31:0] PRDATA_S3;
133
+ wire PREADY_S3;
134
+ wire PSLVERR_S3;
135
+
136
+ //Slave #4
137
+ wire PSEL_S4;
138
+ wire [31:0] PRDATA_S4;
139
+ wire PREADY_S4;
140
+ wire PSLVERR_S4;
141
+
142
+ //Slave #5
143
+ wire PSEL_S5;
144
+ wire [31:0] PRDATA_S5;
145
+ wire PREADY_S5;
146
+ wire PSLVERR_S5;
147
+
148
+ //Slave #6
149
+ wire PSEL_S6;
150
+ wire [31:0] PRDATA_S6;
151
+ wire PREADY_S6;
152
+ wire PSLVERR_S6;
153
+
154
+ //Slave #7
155
+ wire PSEL_S7;
156
+ wire [31:0] PRDATA_S7;
157
+ wire PREADY_S7;
158
+ wire PSLVERR_S7;
159
+
160
+ //Slave #8
161
+ wire PSEL_S8;
162
+ wire [31:0] PRDATA_S8;
163
+ wire PREADY_S8;
164
+ wire PSLVERR_S8;
165
+
166
+ //Slave #9
167
+ wire PSEL_S9;
168
+ wire [31:0] PRDATA_S9;
169
+ wire PREADY_S9;
170
+ wire PSLVERR_S9;
171
+
172
+ //Slave #10
173
+ wire PSEL_S10;
174
+ wire [31:0] PRDATA_S10;
175
+ wire PREADY_S10;
176
+ wire PSLVERR_S10;
177
+
178
+ //Slave #11
179
+ wire PSEL_S11;
180
+ wire [31:0] PRDATA_S11;
181
+ wire PREADY_S11;
182
+ wire PSLVERR_S11;
183
+
184
+ //Slave #12
185
+ wire PSEL_S12;
186
+ wire [31:0] PRDATA_S12;
187
+ wire PREADY_S12;
188
+ wire PSLVERR_S12;
189
+
190
+ //Slave #13
191
+ wire PSEL_S13;
192
+ wire [31:0] PRDATA_S13;
193
+ wire PREADY_S13;
194
+ wire PSLVERR_S13;
195
+
196
+ //Unused Ports Signals
197
+ wire PSEL_S14;
198
+ wire PSEL_S15;
199
+
200
+ wire [31: 0] PRE_S6;
201
+ wire [31: 0] TMRCMP1_S6;
202
+ wire [31: 0] TMRCMP2_S6;
203
+ wire [0: 0] TMREN_S6;
204
+ wire [31: 0] PRE_S7;
205
+ wire [31: 0] TMRCMP1_S7;
206
+ wire [31: 0] TMRCMP2_S7;
207
+ wire [0: 0] TMREN_S7;
208
+ wire [31: 0] TMR_S8;
209
+ wire [31: 0] PRE_S8;
210
+ wire [31: 0] TMRCMP_S8;
211
+ wire [0: 0] TMROV_S8;
212
+ wire [0: 0] TMROVCLR_S8;
213
+ wire [0: 0] TMREN_S8;
214
+ wire [31: 0] TMR_S9;
215
+ wire [31: 0] PRE_S9;
216
+ wire [31: 0] TMRCMP_S9;
217
+ wire [0: 0] TMROV_S9;
218
+ wire [0: 0] TMROVCLR_S9;
219
+ wire [0: 0] TMREN_S9;
220
+ wire [31: 0] TMR_S10;
221
+ wire [31: 0] PRE_S10;
222
+ wire [31: 0] TMRCMP_S10;
223
+ wire [0: 0] TMROV_S10;
224
+ wire [0: 0] TMROVCLR_S10;
225
+ wire [0: 0] TMREN_S10;
226
+ wire [31: 0] TMR_S11;
227
+ wire [31: 0] PRE_S11;
228
+ wire [31: 0] TMRCMP_S11;
229
+ wire [0: 0] TMROV_S11;
230
+ wire [0: 0] TMROVCLR_S11;
231
+ wire [0: 0] TMREN_S11;
232
+ wire [31: 0] WDTMR_S12;
233
+ wire [31: 0] WDLOAD_S12;
234
+ wire [0: 0] WDOV_S12;
235
+ wire [0: 0] WDOVCLR_S12;
236
+ wire [0: 0] WDEN_S12;
237
+ wire [31: 0] WDTMR_S13;
238
+ wire [31: 0] WDLOAD_S13;
239
+ wire [0: 0] WDOV_S13;
240
+ wire [0: 0] WDOVCLR_S13;
241
+ wire [0: 0] WDEN_S13;
242
+
243
+ assign IRQ[15:12] = 4'd0;
244
+
245
+ //Digital module # 0
246
+ APB_UART S0 (
247
+ .PCLK(PCLK),
248
+ .PRESETn(PRESETn),
249
+ .PSEL(PSEL_S0),
250
+ .PADDR(PADDR),
251
+ .PREADY(PREADY_S0),
252
+ .PWRITE(PWRITE),
253
+ .PWDATA(PWDATA),
254
+ .PRDATA(PRDATA_S0),
255
+ .PENABLE(PENABLE),
256
+
257
+ .RsRx(RsRx_S0),
258
+ .RsTx(RsTx_S0),
259
+ .uart_irq(IRQ[0])
260
+ );
261
+
262
+ //Digital module # 1
263
+ APB_UART S1 (
264
+ .PCLK(PCLK),
265
+ .PRESETn(PRESETn),
266
+ .PSEL(PSEL_S1),
267
+ .PADDR(PADDR),
268
+ .PREADY(PREADY_S1),
269
+ .PWRITE(PWRITE),
270
+ .PWDATA(PWDATA),
271
+ .PRDATA(PRDATA_S1),
272
+ .PENABLE(PENABLE),
273
+
274
+ .RsRx(RsRx_S1),
275
+ .RsTx(RsTx_S1),
276
+ .uart_irq(IRQ[1])
277
+ );
278
+
279
+ //Digital module # 2
280
+ APB_SPI S2 (
281
+ .PCLK(PCLK),
282
+ .PRESETn(PRESETn),
283
+ .PSEL(PSEL_S2),
284
+ .PADDR(PADDR),
285
+ .PREADY(PREADY_S2),
286
+ .PWRITE(PWRITE),
287
+ .PWDATA(PWDATA),
288
+ .PRDATA(PRDATA_S2),
289
+ .PENABLE(PENABLE),
290
+
291
+ .MSI(MSI_S2),
292
+ .MSO(MSO_S2),
293
+ .SSn(SSn_S2),
294
+ .SCLK(SCLK_S2),
295
+
296
+ .IRQ(IRQ[2])
297
+ );
298
+
299
+ //Digital module # 3
300
+ APB_SPI S3 (
301
+ .PCLK(PCLK),
302
+ .PRESETn(PRESETn),
303
+ .PSEL(PSEL_S3),
304
+ .PADDR(PADDR),
305
+ .PREADY(PREADY_S3),
306
+ .PWRITE(PWRITE),
307
+ .PWDATA(PWDATA),
308
+ .PRDATA(PRDATA_S3),
309
+ .PENABLE(PENABLE),
310
+
311
+ .MSI(MSI_S3),
312
+ .MSO(MSO_S3),
313
+ .SSn(SSn_S3),
314
+ .SCLK(SCLK_S3),
315
+
316
+ .IRQ(IRQ[3])
317
+ );
318
+
319
+ //Digital module # 4
320
+ APB_I2C S4 (
321
+ .PCLK(PCLK),
322
+ .PRESETn(PRESETn),
323
+ .PSEL(PSEL_S4),
324
+ .PADDR(PADDR),
325
+ .PREADY(PREADY_S4),
326
+ .PWRITE(PWRITE),
327
+ .PWDATA(PWDATA),
328
+ .PRDATA(PRDATA_S4),
329
+ .PENABLE(PENABLE),
330
+
331
+ .scl_i(scl_i_S4),
332
+ .scl_o(scl_o_S4),
333
+ .scl_oen_o(scl_oen_o_S4),
334
+ .sda_i(sda_i_S4),
335
+ .sda_o(sda_o_S4),
336
+ .sda_oen_o(sda_oen_o_S4),
337
+
338
+ .IRQ(IRQ[4])
339
+ );
340
+
341
+ //Digital module # 5
342
+ APB_I2C S5 (
343
+ .PCLK(PCLK),
344
+ .PRESETn(PRESETn),
345
+ .PSEL(PSEL_S5),
346
+ .PADDR(PADDR),
347
+ .PREADY(PREADY_S5),
348
+ .PWRITE(PWRITE),
349
+ .PWDATA(PWDATA),
350
+ .PRDATA(PRDATA_S5),
351
+ .PENABLE(PENABLE),
352
+
353
+ .scl_i(scl_i_S5),
354
+ .scl_o(scl_o_S5),
355
+ .scl_oen_o(scl_oen_o_S5),
356
+ .sda_i(sda_i_S5),
357
+ .sda_o(sda_o_S5),
358
+ .sda_oen_o(sda_oen_o_S5),
359
+
360
+ .IRQ(IRQ[5])
361
+ );
362
+
363
+ //Digital module # 6
364
+ PWM32 S6 (
365
+ .clk(PCLK),
366
+ .rst(~PRESETn),
367
+ .PRE(PRE_S6),
368
+ .TMRCMP1(TMRCMP1_S6),
369
+ .TMRCMP2(TMRCMP2_S6),
370
+ .TMREN(TMREN_S6),
371
+
372
+ .pwm(pwm_S6)
373
+ );
374
+
375
+ //APB Slave # 6
376
+ APB_PWM32 S_6 (
377
+ .PCLK(PCLK),
378
+ //.PCLKG(),
379
+ .PRESETn(PRESETn),
380
+ .PSEL(PSEL_S6),
381
+ .PADDR(PADDR [19:2]),
382
+ .PREADY(PREADY_S6),
383
+ .PWRITE(PWRITE),
384
+ .PENABLE(PENABLE),
385
+ .PWDATA(PWDATA),
386
+
387
+ .PRE(PRE_S6),
388
+ .TMRCMP1(TMRCMP1_S6),
389
+ .TMRCMP2(TMRCMP2_S6),
390
+ .TMREN(TMREN_S6),
391
+ .PRDATA(PRDATA_S6)
392
+ );
393
+
394
+ //Digital module # 7
395
+ PWM32 S7 (
396
+ .clk(PCLK),
397
+ .rst(~PRESETn),
398
+ .PRE(PRE_S7),
399
+ .TMRCMP1(TMRCMP1_S7),
400
+ .TMRCMP2(TMRCMP2_S7),
401
+ .TMREN(TMREN_S7),
402
+
403
+ .pwm(pwm_S7)
404
+ );
405
+
406
+ //APB Slave # 7
407
+ APB_PWM32 S_7 (
408
+ .PCLK(PCLK),
409
+ //.PCLKG(),
410
+ .PRESETn(PRESETn),
411
+ .PSEL(PSEL_S7),
412
+ .PADDR(PADDR [19:2]),
413
+ .PREADY(PREADY_S7),
414
+ .PWRITE(PWRITE),
415
+ .PENABLE(PENABLE),
416
+ .PWDATA(PWDATA),
417
+
418
+ .PRE(PRE_S7),
419
+ .TMRCMP1(TMRCMP1_S7),
420
+ .TMRCMP2(TMRCMP2_S7),
421
+ .TMREN(TMREN_S7),
422
+ .PRDATA(PRDATA_S7)
423
+ );
424
+
425
+ //Digital module # 8
426
+ TIMER32 S8 (
427
+ .clk(PCLK),
428
+ .rst(~PRESETn),
429
+ .TMR(TMR_S8),
430
+ .PRE(PRE_S8),
431
+ .TMRCMP(TMRCMP_S8),
432
+ .TMROV(TMROV_S8),
433
+ .TMROVCLR(TMROVCLR_S8),
434
+ .TMREN(TMREN_S8)
435
+
436
+ );
437
+
438
+ //APB Slave # 8
439
+ APB_TIMER32 S_8 (
440
+ .PCLK(PCLK),
441
+ //.PCLKG(),
442
+ .PRESETn(PRESETn),
443
+ .PSEL(PSEL_S8),
444
+ .PADDR(PADDR [19:2]),
445
+ .PREADY(PREADY_S8),
446
+ .PWRITE(PWRITE),
447
+ .PENABLE(PENABLE),
448
+ .PWDATA(PWDATA),
449
+
450
+ .TMR(TMR_S8),
451
+ .PRE(PRE_S8),
452
+ .TMRCMP(TMRCMP_S8),
453
+ .TMROV(TMROV_S8),
454
+ .TMROVCLR(TMROVCLR_S8),
455
+ .TMREN(TMREN_S8),
456
+
457
+ .IRQ(IRQ[6]),
458
+ .PRDATA(PRDATA_S8)
459
+ );
460
+
461
+ //Digital module # 9
462
+ TIMER32 S9 (
463
+ .clk(PCLK),
464
+ .rst(~PRESETn),
465
+ .TMR(TMR_S9),
466
+ .PRE(PRE_S9),
467
+ .TMRCMP(TMRCMP_S9),
468
+ .TMROV(TMROV_S9),
469
+ .TMROVCLR(TMROVCLR_S9),
470
+ .TMREN(TMREN_S9)
471
+
472
+ );
473
+
474
+ //APB Slave # 9
475
+ APB_TIMER32 S_9 (
476
+ .PCLK(PCLK),
477
+ //.PCLKG(),
478
+ .PRESETn(PRESETn),
479
+ .PSEL(PSEL_S9),
480
+ .PADDR(PADDR [19:2]),
481
+ .PREADY(PREADY_S9),
482
+ .PWRITE(PWRITE),
483
+ .PENABLE(PENABLE),
484
+ .PWDATA(PWDATA),
485
+
486
+ .TMR(TMR_S9),
487
+ .PRE(PRE_S9),
488
+ .TMRCMP(TMRCMP_S9),
489
+ .TMROV(TMROV_S9),
490
+ .TMROVCLR(TMROVCLR_S9),
491
+ .TMREN(TMREN_S9),
492
+
493
+ .IRQ(IRQ[7]),
494
+ .PRDATA(PRDATA_S9)
495
+ );
496
+
497
+ //Digital module # 10
498
+ TIMER32 S10 (
499
+ .clk(PCLK),
500
+ .rst(~PRESETn),
501
+ .TMR(TMR_S10),
502
+ .PRE(PRE_S10),
503
+ .TMRCMP(TMRCMP_S10),
504
+ .TMROV(TMROV_S10),
505
+ .TMROVCLR(TMROVCLR_S10),
506
+ .TMREN(TMREN_S10)
507
+ );
508
+
509
+ //APB Slave # 10
510
+ APB_TIMER32 S_10 (
511
+ .PCLK(PCLK),
512
+ //.PCLKG(),
513
+ .PRESETn(PRESETn),
514
+ .PSEL(PSEL_S10),
515
+ .PADDR(PADDR [19:2]),
516
+ .PREADY(PREADY_S10),
517
+ .PWRITE(PWRITE),
518
+ .PENABLE(PENABLE),
519
+ .PWDATA(PWDATA),
520
+
521
+ .TMR(TMR_S10),
522
+ .PRE(PRE_S10),
523
+ .TMRCMP(TMRCMP_S10),
524
+ .TMROV(TMROV_S10),
525
+ .TMROVCLR(TMROVCLR_S10),
526
+ .TMREN(TMREN_S10),
527
+
528
+ .IRQ(IRQ[8]),
529
+ .PRDATA(PRDATA_S10)
530
+ );
531
+
532
+ //Digital module # 11
533
+ TIMER32 S11 (
534
+ .clk(PCLK),
535
+ .rst(~PRESETn),
536
+ .TMR(TMR_S11),
537
+ .PRE(PRE_S11),
538
+ .TMRCMP(TMRCMP_S11),
539
+ .TMROV(TMROV_S11),
540
+ .TMROVCLR(TMROVCLR_S11),
541
+ .TMREN(TMREN_S11)
542
+
543
+ );
544
+
545
+ //APB Slave # 11
546
+ APB_TIMER32 S_11 (
547
+ .PCLK(PCLK),
548
+ //.PCLKG(),
549
+ .PRESETn(PRESETn),
550
+ .PSEL(PSEL_S11),
551
+ .PADDR(PADDR [19:2]),
552
+ .PREADY(PREADY_S11),
553
+ .PWRITE(PWRITE),
554
+ .PENABLE(PENABLE),
555
+ .PWDATA(PWDATA),
556
+
557
+ .TMR(TMR_S11),
558
+ .PRE(PRE_S11),
559
+ .TMRCMP(TMRCMP_S11),
560
+ .TMROV(TMROV_S11),
561
+ .TMROVCLR(TMROVCLR_S11),
562
+ .TMREN(TMREN_S11),
563
+ .IRQ(IRQ[9]),
564
+ .PRDATA(PRDATA_S11)
565
+ );
566
+
567
+ //Digital module # 12
568
+ WDT32 S12 (
569
+ .clk(PCLK),
570
+ .rst(~PRESETn),
571
+ .WDTMR(WDTMR_S12),
572
+ .WDLOAD(WDLOAD_S12),
573
+ .WDOV(WDOV_S12),
574
+ .WDOVCLR(WDOVCLR_S12),
575
+ .WDEN(WDEN_S12)
576
+
577
+ );
578
+
579
+ //APB Slave # 12
580
+ APB_WDT32 S_12 (
581
+ .PCLK(PCLK),
582
+ //.PCLKG(),
583
+ .PRESETn(PRESETn),
584
+ .PSEL(PSEL_S12),
585
+ .PADDR(PADDR [19:2]),
586
+ .PREADY(PREADY_S12),
587
+ .PWRITE(PWRITE),
588
+ .PENABLE(PENABLE),
589
+ .PWDATA(PWDATA),
590
+
591
+ .WDTMR(WDTMR_S12),
592
+ .WDLOAD(WDLOAD_S12),
593
+ .WDOV(WDOV_S12),
594
+ .WDOVCLR(WDOVCLR_S12),
595
+ .WDEN(WDEN_S12),
596
+ .IRQ(IRQ[10]),
597
+ .PRDATA(PRDATA_S12)
598
+ );
599
+
600
+ //Digital module # 13
601
+ WDT32 S13 (
602
+ .clk(PCLK),
603
+ .rst(~PRESETn),
604
+ .WDTMR(WDTMR_S13),
605
+ .WDLOAD(WDLOAD_S13),
606
+ .WDOV(WDOV_S13),
607
+ .WDOVCLR(WDOVCLR_S13),
608
+ .WDEN(WDEN_S13)
609
+
610
+ );
611
+
612
+ //APB Slave # 13
613
+ APB_WDT32 S_13 (
614
+ .PCLK(PCLK),
615
+ //.PCLKG(),
616
+ .PRESETn(PRESETn),
617
+ .PSEL(PSEL_S13),
618
+ .PADDR(PADDR [19:2]),
619
+ .PREADY(PREADY_S13),
620
+ .PWRITE(PWRITE),
621
+ .PENABLE(PENABLE),
622
+ .PWDATA(PWDATA),
623
+
624
+ .WDTMR(WDTMR_S13),
625
+ .WDLOAD(WDLOAD_S13),
626
+ .WDOV(WDOV_S13),
627
+ .WDOVCLR(WDOVCLR_S13),
628
+ .WDEN(WDEN_S13),
629
+
630
+ .IRQ(IRQ[11]),
631
+ .PRDATA(PRDATA_S13)
632
+ );
633
+
634
+
635
+ //APB Bus
636
+ APB_BUS0 #(
637
+ .PORT0_ENABLE (1),
638
+ .PORT1_ENABLE (1),
639
+ .PORT2_ENABLE (1),
640
+ .PORT3_ENABLE (1),
641
+ .PORT4_ENABLE (1),
642
+ .PORT5_ENABLE (1),
643
+ .PORT6_ENABLE (1),
644
+ .PORT7_ENABLE (1),
645
+ .PORT8_ENABLE (1),
646
+ .PORT9_ENABLE (1),
647
+ .PORT10_ENABLE (1),
648
+ .PORT11_ENABLE (1),
649
+ .PORT12_ENABLE (1),
650
+ .PORT13_ENABLE (1),
651
+ .PORT14_ENABLE (0),
652
+ .PORT15_ENABLE (0)
653
+ )
654
+ apbBus(
655
+ // Inputs
656
+ .DEC_BITS (PADDR[23:20]),
657
+ .PSEL (PSEL),
658
+
659
+ .PSEL_S0 (PSEL_S0),
660
+ .PREADY_S0 (PREADY_S0),
661
+ .PRDATA_S0 (PRDATA_S0),
662
+ // .PSLVERR0 (timer0_pslverr),
663
+ .PSLVERR_S0 (1'b0),
664
+
665
+ .PSEL_S1 (PSEL_S1),
666
+ .PREADY_S1 (PREADY_S1),
667
+ .PRDATA_S1 (PRDATA_S1),
668
+ // .PSLVERR1 (timer1_pslverr),
669
+ .PSLVERR_S1 (1'b0),
670
+
671
+ .PSEL_S2 (PSEL_S2),
672
+ .PREADY_S2 (PREADY_S2),
673
+ .PRDATA_S2 (PRDATA_S2),
674
+ // .PSLVERR2 (timer2_pslverr),
675
+ .PSLVERR_S2 (1'b0),
676
+
677
+ .PSEL_S3 (PSEL_S3),
678
+ .PREADY_S3 (PREADY_S3),
679
+ .PRDATA_S3 (PRDATA_S3),
680
+ // .PSLVERR3 (timer3_pslverr),
681
+ .PSLVERR_S3 (1'b0),
682
+
683
+ .PSEL_S4 (PSEL_S4),
684
+ .PREADY_S4 (PREADY_S4),
685
+ .PRDATA_S4 (PRDATA_S4),
686
+ // .PSLVERR4 (timer4_pslverr),
687
+ .PSLVERR_S4 (1'b0),
688
+
689
+ .PSEL_S5 (PSEL_S5),
690
+ .PREADY_S5 (PREADY_S5),
691
+ .PRDATA_S5 (PRDATA_S5),
692
+ // .PSLVERR5 (timer5_pslverr),
693
+ .PSLVERR_S5 (1'b0),
694
+
695
+ .PSEL_S6 (PSEL_S6),
696
+ .PREADY_S6 (PREADY_S6),
697
+ .PRDATA_S6 (PRDATA_S6),
698
+ // .PSLVERR6 (timer6_pslverr),
699
+ .PSLVERR_S6 (1'b0),
700
+
701
+ .PSEL_S7 (PSEL_S7),
702
+ .PREADY_S7 (PREADY_S7),
703
+ .PRDATA_S7 (PRDATA_S7),
704
+ // .PSLVERR7 (timer7_pslverr),
705
+ .PSLVERR_S7 (1'b0),
706
+
707
+ .PSEL_S8 (PSEL_S8),
708
+ .PREADY_S8 (PREADY_S8),
709
+ .PRDATA_S8 (PRDATA_S8),
710
+ // .PSLVERR8 (timer8_pslverr),
711
+ .PSLVERR_S8 (1'b0),
712
+
713
+ .PSEL_S9 (PSEL_S9),
714
+ .PREADY_S9 (PREADY_S9),
715
+ .PRDATA_S9 (PRDATA_S9),
716
+ // .PSLVERR9 (timer9_pslverr),
717
+ .PSLVERR_S9 (1'b0),
718
+
719
+ .PSEL_S10 (PSEL_S10),
720
+ .PREADY_S10 (PREADY_S10),
721
+ .PRDATA_S10 (PRDATA_S10),
722
+ // .PSLVERR10 (timer10_pslverr),
723
+ .PSLVERR_S10 (1'b0),
724
+
725
+ .PSEL_S11 (PSEL_S11),
726
+ .PREADY_S11 (PREADY_S11),
727
+ .PRDATA_S11 (PRDATA_S11),
728
+ // .PSLVERR11 (timer11_pslverr),
729
+ .PSLVERR_S11 (1'b0),
730
+
731
+ .PSEL_S12 (PSEL_S12),
732
+ .PREADY_S12 (PREADY_S12),
733
+ .PRDATA_S12 (PRDATA_S12),
734
+ // .PSLVERR12 (timer12_pslverr),
735
+ .PSLVERR_S12 (1'b0),
736
+
737
+ .PSEL_S13 (PSEL_S13),
738
+ .PREADY_S13 (PREADY_S13),
739
+ .PRDATA_S13 (PRDATA_S13),
740
+ // .PSLVERR13 (timer13_pslverr),
741
+ .PSLVERR_S13 (1'b0),
742
+
743
+ .PSEL_S14 (PSEL_S14),
744
+ .PREADY_S14 (1'b1),
745
+ .PRDATA_S14 (32'h00000000),
746
+ .PSLVERR_S14 (1'b0),
747
+
748
+ .PSEL_S15 (PSEL_S15),
749
+ .PREADY_S15 (1'b1),
750
+ .PRDATA_S15 (32'h00000000),
751
+ .PSLVERR_S15 (1'b0),
752
+
753
+ // Output
754
+ .PREADY (PREADY),
755
+ .PRDATA (PRDATA),
756
+ .PSLVERR (PSLVERR)
757
+ );
758
+
759
+ endmodule
760
+
chips/openroad_flow_scripts/flow/designs/src/chameleon/IPs/AHBSRAM.v ADDED
@@ -0,0 +1,334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ module AHBSRAM#( parameter AW = 14)( // Address width
3
+ input HCLK, // system bus clock
4
+ input HRESETn, // system bus reset
5
+ input HSEL, // AHB peripheral select
6
+ input HREADY, // AHB ready input
7
+ input [1:0] HTRANS, // AHB transfer type
8
+ input [2:0] HSIZE, // AHB hsize
9
+ input HWRITE, // AHB hwrite
10
+ input [AW-1:0] HADDR, // AHB address bus
11
+ input [31:0] HWDATA, // AHB write data bus
12
+ output HREADYOUT, // AHB ready output to S->M mux
13
+ output HRESP, // AHB response
14
+ output [31:0] HRDATA, // AHB read data bus
15
+
16
+ input [31:0] SRAMRDATA, // SRAM Read Data
17
+ output [AW-3:0] SRAMADDR, // SRAM address
18
+ output [3:0] SRAMWEN, // SRAM write enable (active high)
19
+ output [31:0] SRAMWDATA, // SRAM write data
20
+ output SRAMCS // SRAM Chip Select (active high)
21
+ );
22
+ reg [(AW-3):0] buf_addr; // Write address buffer
23
+ reg [ 3:0] buf_we; // Write enable buffer (data phase)
24
+ reg buf_hit; // High when AHB read address
25
+ // matches buffered address
26
+ reg [31:0] buf_data; // AHB write bus buffered
27
+ reg buf_pend; // Buffer write data valid
28
+ reg buf_data_en;//Data buffer write enable (data phase)
29
+ wire ahb_access = HTRANS[1] & HSEL & HREADY;
30
+ wire ahb_write = ahb_access & HWRITE;
31
+ wire ahb_read = ahb_access & (~HWRITE);
32
+
33
+ // Stored write data in pending state if new transfer is read
34
+ // buf_data_en indicate new write (data phase)
35
+ // ahb_read indicate new read (address phase)
36
+ // buf_pend is registered version of buf_pend_nxt
37
+ wire buf_pend_nxt = (buf_pend | buf_data_en) & ahb_read;
38
+
39
+ // RAM write happens when
40
+ // - write pending (buf_pend), or
41
+ // - new AHB write seen (buf_data_en) at data phase,
42
+ // - and not reading (address phase)
43
+ wire ram_write = (buf_pend | buf_data_en) & (~ahb_read); // ahb_write
44
+ // RAM WE is the buffered WE
45
+ assign SRAMWEN = {4{ram_write}} & buf_we[3:0];
46
+ // RAM address is the buffered address for RAM write otherwise HADDR
47
+ assign SRAMADDR = ahb_read ? HADDR[AW-1:2] : buf_addr;
48
+ // RAM chip select during read or write
49
+ assign SRAMCS = ahb_read | ram_write;
50
+ // Byte lane decoder and next state logic
51
+ wire tx_byte = (~HSIZE[1]) & (~HSIZE[0]);
52
+ wire tx_half = (~HSIZE[1]) & HSIZE[0];
53
+ wire tx_word = HSIZE[1];
54
+ wire byte_at_00 = tx_byte & (~HADDR[1]) & (~HADDR[0]);
55
+ wire byte_at_01 = tx_byte & (~HADDR[1]) & HADDR[0];
56
+ wire byte_at_10 = tx_byte & HADDR[1] & (~HADDR[0]);
57
+ wire byte_at_11 = tx_byte & HADDR[1] & HADDR[0];
58
+ wire half_at_00 = tx_half & (~HADDR[1]);
59
+ wire half_at_10 = tx_half & HADDR[1];
60
+ wire word_at_00 = tx_word;
61
+ wire byte_sel_0 = word_at_00 | half_at_00 | byte_at_00;
62
+ wire byte_sel_1 = word_at_00 | half_at_00 | byte_at_01;
63
+ wire byte_sel_2 = word_at_00 | half_at_10 | byte_at_10;
64
+ wire byte_sel_3 = word_at_00 | half_at_10 | byte_at_11;
65
+ // Address phase byte lane strobe
66
+ wire [3:0] buf_we_nxt ={byte_sel_3 & ahb_write, byte_sel_2 & ahb_write,
67
+ byte_sel_1 & ahb_write,byte_sel_0 & ahb_write};
68
+ // buf_data_en is data phase write control
69
+ always @(posedge HCLK or negedge HRESETn)
70
+ if (~HRESETn)
71
+ buf_data_en <= 1'b0;
72
+ else
73
+ buf_data_en <= ahb_write;
74
+
75
+ always @(posedge HCLK)
76
+ if(buf_we[3] & buf_data_en)
77
+ buf_data[31:24] <= HWDATA[31:24];
78
+
79
+ always @(posedge HCLK)
80
+ if(buf_we[2] & buf_data_en)
81
+ buf_data[23:16] <= HWDATA[23:16];
82
+
83
+ always @(posedge HCLK)
84
+ if(buf_we[1] & buf_data_en)
85
+ buf_data[15: 8] <= HWDATA[15: 8];
86
+
87
+ always @(posedge HCLK)
88
+ if(buf_we[0] & buf_data_en)
89
+ buf_data[ 7: 0] <= HWDATA[ 7: 0];
90
+
91
+ // buf_we keep the valid status of each byte (data phase)
92
+ always @(posedge HCLK or negedge HRESETn)
93
+ if (~HRESETn)
94
+ buf_we <= 4'b0000;
95
+ else if(ahb_write)
96
+ buf_we <= buf_we_nxt;
97
+
98
+ always @(posedge HCLK or negedge HRESETn)
99
+ begin
100
+ if (~HRESETn)
101
+ buf_addr <= {(AW-2){1'b0}};
102
+ else if (ahb_write)
103
+ buf_addr <= HADDR[(AW-1):2];
104
+ end
105
+ // Buf_hit detection logic
106
+ wire buf_hit_nxt = (HADDR[AW-1:2] == buf_addr[AW-3:0]);
107
+ // ----------------------------------------------------------
108
+ // Read data merge : This is for the case when there is a AHB
109
+ // write followed by AHB read to the same address. In this case
110
+ // the data is merged from the buffer as the RAM write to that
111
+ // address hasn't happened yet
112
+ // ----------------------------------------------------------
113
+ wire [ 3:0] merge1 = {4{buf_hit}} & buf_we; // data phase, buf_we indicates data is valid
114
+ assign HRDATA={merge1[3] ? buf_data[31:24] : SRAMRDATA[31:24],
115
+ merge1[2] ? buf_data[23:16] : SRAMRDATA[23:16],
116
+ merge1[1] ? buf_data[15: 8] : SRAMRDATA[15: 8],
117
+ merge1[0] ? buf_data[ 7: 0] : SRAMRDATA[ 7: 0]};
118
+
119
+ // Synchronous state update
120
+ always @(posedge HCLK or negedge HRESETn)
121
+ if (~HRESETn)
122
+ buf_hit <= 1'b0;
123
+ else if(ahb_read)
124
+ buf_hit <= buf_hit_nxt;
125
+
126
+ always @(posedge HCLK or negedge HRESETn)
127
+ if (~HRESETn)
128
+ buf_pend <= 1'b0;
129
+ else
130
+ buf_pend <= buf_pend_nxt;
131
+
132
+ // if there is an AHB write and valid data in the buffer, RAM write data
133
+ // comes from the buffer. otherwise comes from the HWDATA
134
+ assign SRAMWDATA = (buf_pend) ? buf_data : HWDATA[31:0];
135
+ assign HREADYOUT = 1'b1;
136
+ assign HRESP = 1'b0;
137
+ endmodule
138
+ */
139
+ module AHBSRAM #(
140
+ // --------------------------------------------------------------------------
141
+ // Parameter Declarations
142
+ // --------------------------------------------------------------------------
143
+ parameter AW = 14) // Address width
144
+ (
145
+ // --------------------------------------------------------------------------
146
+ // Port Definitions
147
+ // --------------------------------------------------------------------------
148
+ input wire HCLK, // system bus clock
149
+ input wire HRESETn, // system bus reset
150
+ input wire HSEL, // AHB peripheral select
151
+ input wire HREADY, // AHB ready input
152
+ input wire [1:0] HTRANS, // AHB transfer type
153
+ input wire [2:0] HSIZE, // AHB hsize
154
+ input wire HWRITE, // AHB hwrite
155
+ input wire [31:0] HADDR, // AHB address bus
156
+ input wire [31:0] HWDATA, // AHB write data bus
157
+ output wire HREADYOUT, // AHB ready output to S->M mux
158
+ output wire [1:0] HRESP, // AHB response
159
+ output wire [31:0] HRDATA, // AHB read data bus
160
+
161
+ input wire [31:0] SRAMRDATA, // SRAM Read Data
162
+ output wire [3:0] SRAMWEN, // SRAM write enable (active high)
163
+ output wire [31:0] SRAMWDATA, // SRAM write data
164
+ output wire SRAMCS0,
165
+ //output wire SRAMCS1,
166
+ //output wire SRAMCS2,
167
+ //output wire SRAMCS3,
168
+ output wire [AW:0] SRAMADDR // SRAM address
169
+ ); // SRAM Chip Select (active high)
170
+
171
+ // ----------------------------------------------------------
172
+ // Internal state
173
+ // ----------------------------------------------------------
174
+ reg [(AW-3 - 0):0] buf_addr; // Write address buffer
175
+ reg [ 3:0] buf_we; // Write enable buffer (data phase)
176
+ reg buf_hit; // High when AHB read address
177
+ // matches buffered address
178
+ reg [31:0] buf_data; // AHB write bus buffered
179
+ reg buf_pend; // Buffer write data valid
180
+ reg buf_data_en; // Data buffer write enable (data phase)
181
+
182
+ // ----------------------------------------------------------
183
+ // Read/write control logic
184
+ // ----------------------------------------------------------
185
+
186
+ wire ahb_access = HTRANS[1] & HSEL & HREADY;
187
+ wire ahb_write = ahb_access & HWRITE;
188
+ wire ahb_read = ahb_access & (~HWRITE);
189
+
190
+
191
+ // Stored write data in pending state if new transfer is read
192
+ // buf_data_en indicate new write (data phase)
193
+ // ahb_read indicate new read (address phase)
194
+ // buf_pend is registered version of buf_pend_nxt
195
+ wire buf_pend_nxt = (buf_pend | buf_data_en) & ahb_read;
196
+
197
+ // RAM write happens when
198
+ // - write pending (buf_pend), or
199
+ // - new AHB write seen (buf_data_en) at data phase,
200
+ // - and not reading (address phase)
201
+ wire ram_write = (buf_pend | buf_data_en) & (~ahb_read); // ahb_write
202
+
203
+ // RAM WE is the buffered WE
204
+ assign SRAMWEN = {4{ram_write}} & buf_we[3:0];
205
+
206
+ // RAM address is the buffered address for RAM write otherwise HADDR
207
+ assign SRAMADDR = ahb_read ? HADDR[AW-1:2] : buf_addr;
208
+
209
+ // RAM chip select during read or write
210
+ wire SRAMCS_src;
211
+ assign SRAMCS_src = ahb_read | ram_write;
212
+ assign SRAMCS0 = SRAMCS_src; // & (~HADDR[AW + 3]) & (~HADDR[AW + 2]);
213
+ //assign SRAMCS1 = SRAMCS_src & (~HADDR[AW + 3]) & (HADDR[AW + 2]);
214
+ //assign SRAMCS2 = SRAMCS_src & (HADDR[AW + 3]) & (~HADDR[AW + 2]);
215
+ //assign SRAMCS3 = SRAMCS_src & (HADDR[AW + 3]) & (HADDR[AW + 2]);
216
+ // ----------------------------------------------------------
217
+ // Byte lane decoder and next state logic
218
+ // ----------------------------------------------------------
219
+
220
+ wire tx_byte = (~HSIZE[1]) & (~HSIZE[0]);
221
+ wire tx_half = (~HSIZE[1]) & HSIZE[0];
222
+ wire tx_word = HSIZE[1];
223
+
224
+ wire byte_at_00 = tx_byte & (~HADDR[1]) & (~HADDR[0]);
225
+ wire byte_at_01 = tx_byte & (~HADDR[1]) & HADDR[0];
226
+ wire byte_at_10 = tx_byte & HADDR[1] & (~HADDR[0]);
227
+ wire byte_at_11 = tx_byte & HADDR[1] & HADDR[0];
228
+
229
+ wire half_at_00 = tx_half & (~HADDR[1]);
230
+ wire half_at_10 = tx_half & HADDR[1];
231
+
232
+ wire word_at_00 = tx_word;
233
+
234
+ wire byte_sel_0 = word_at_00 | half_at_00 | byte_at_00;
235
+ wire byte_sel_1 = word_at_00 | half_at_00 | byte_at_01;
236
+ wire byte_sel_2 = word_at_00 | half_at_10 | byte_at_10;
237
+ wire byte_sel_3 = word_at_00 | half_at_10 | byte_at_11;
238
+
239
+ // Address phase byte lane strobe
240
+ wire [3:0] buf_we_nxt = { byte_sel_3 & ahb_write,
241
+ byte_sel_2 & ahb_write,
242
+ byte_sel_1 & ahb_write,
243
+ byte_sel_0 & ahb_write };
244
+
245
+ // ----------------------------------------------------------
246
+ // Write buffer
247
+ // ----------------------------------------------------------
248
+
249
+ // buf_data_en is data phase write control
250
+ always @(posedge HCLK or negedge HRESETn)
251
+ if (~HRESETn)
252
+ buf_data_en <= 1'b0;
253
+ else
254
+ buf_data_en <= ahb_write;
255
+
256
+ always @(posedge HCLK)
257
+ if(buf_we[3] & buf_data_en)
258
+ buf_data[31:24] <= HWDATA[31:24];
259
+
260
+ always @(posedge HCLK)
261
+ if(buf_we[2] & buf_data_en)
262
+ buf_data[23:16] <= HWDATA[23:16];
263
+
264
+ always @(posedge HCLK)
265
+ if(buf_we[1] & buf_data_en)
266
+ buf_data[15: 8] <= HWDATA[15: 8];
267
+
268
+ always @(posedge HCLK)
269
+ if(buf_we[0] & buf_data_en)
270
+ buf_data[ 7: 0] <= HWDATA[ 7: 0];
271
+
272
+ // buf_we keep the valid status of each byte (data phase)
273
+ always @(posedge HCLK or negedge HRESETn)
274
+ if (~HRESETn)
275
+ buf_we <= 4'b0000;
276
+ else if(ahb_write)
277
+ buf_we <= buf_we_nxt;
278
+
279
+ always @(posedge HCLK or negedge HRESETn)
280
+ begin
281
+ if (~HRESETn)
282
+ buf_addr <= {(AW-2){1'b0}};
283
+ else if (ahb_write)
284
+ buf_addr <= HADDR[(AW-1):2];
285
+ end
286
+ // ----------------------------------------------------------
287
+ // Buf_hit detection logic
288
+ // ----------------------------------------------------------
289
+
290
+ wire buf_hit_nxt = (HADDR[AW-1:2] == buf_addr[AW-3 - 0:0]);
291
+
292
+ // ----------------------------------------------------------
293
+ // Read data merge : This is for the case when there is a AHB
294
+ // write followed by AHB read to the same address. In this case
295
+ // the data is merged from the buffer as the RAM write to that
296
+ // address hasn't happened yet
297
+ // ----------------------------------------------------------
298
+
299
+ wire [ 3:0] merge1 = {4{buf_hit}} & buf_we; // data phase, buf_we indicates data is valid
300
+
301
+ assign HRDATA =
302
+ { merge1[3] ? buf_data[31:24] : SRAMRDATA[31:24],
303
+ merge1[2] ? buf_data[23:16] : SRAMRDATA[23:16],
304
+ merge1[1] ? buf_data[15: 8] : SRAMRDATA[15: 8],
305
+ merge1[0] ? buf_data[ 7: 0] : SRAMRDATA[ 7: 0] };
306
+
307
+ // ----------------------------------------------------------
308
+ // Synchronous state update
309
+ // ----------------------------------------------------------
310
+
311
+ always @(posedge HCLK or negedge HRESETn)
312
+ if (~HRESETn)
313
+ buf_hit <= 1'b0;
314
+ else if(ahb_read)
315
+ buf_hit <= buf_hit_nxt;
316
+
317
+ always @(posedge HCLK or negedge HRESETn)
318
+ if (~HRESETn)
319
+ buf_pend <= 1'b0;
320
+ else
321
+ buf_pend <= buf_pend_nxt;
322
+
323
+ // if there is an AHB write and valid data in the buffer, RAM write data
324
+ // comes from the buffer. otherwise comes from the HWDATA
325
+ assign SRAMWDATA = (buf_pend) ? buf_data : HWDATA[31:0];
326
+
327
+ // ----------------------------------------------------------
328
+ // Assign outputs
329
+ // ----------------------------------------------------------
330
+ assign HREADYOUT = 1'b1;
331
+ assign HRESP = 2'b0;
332
+
333
+
334
+ endmodule
chips/openroad_flow_scripts/flow/designs/src/chameleon/IPs/APB_I2C.v ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Mohamed Shalan (mshalan@aucegypt.edu)
3
+ */
4
+ /*
5
+ APB interface for the OC i2c master controller.
6
+ The registers:
7
+
8
+ */
9
+
10
+ `timescale 1ns/1ps
11
+ `default_nettype none
12
+
13
+ module APB_I2C(
14
+ //APB Inputs
15
+ input wire PCLK,
16
+ input wire PRESETn,
17
+ input wire PWRITE,
18
+ input wire [31:0] PWDATA,
19
+ input wire [31:0] PADDR,
20
+ input wire PENABLE,
21
+
22
+ input PSEL,
23
+
24
+ //APB Outputs
25
+ output wire PREADY,
26
+ output wire [31:0] PRDATA,
27
+
28
+ output wire IRQ,
29
+
30
+ // i2c Ports
31
+ input wire scl_i, // SCL-line input
32
+ output wire scl_o, // SCL-line output (always 1'b0)
33
+ output wire scl_oen_o, // SCL-line output enable (active low)
34
+ input wire sda_i, // SDA-line input
35
+ output wire sda_o, // SDA-line output (always 1'b0)
36
+ output wire sda_oen_o // SDA-line output enable (active low)
37
+
38
+ );
39
+
40
+ assign PREADY = 1'b1; //always ready
41
+
42
+ wire[7:0] io_do;
43
+ wire io_we = PENABLE & PWRITE & PREADY & PSEL;
44
+ wire io_re = PENABLE & ~PWRITE & PREADY & PSEL;
45
+
46
+ wire i2c_irq;
47
+
48
+ reg I2C_IM_REG;
49
+
50
+ assign IRQ = i2c_irq & I2C_IM_REG;
51
+
52
+ // IM Register -- Size: 1 -- Offset: 0x14
53
+ always @(posedge PCLK, negedge PRESETn)
54
+ begin
55
+ if(!PRESETn)
56
+ begin
57
+ I2C_IM_REG <= 1'b0;
58
+ end
59
+ else if(PENABLE & PWRITE & PREADY & PSEL & (PADDR[4:2] == 3'h7))
60
+ I2C_IM_REG <= PWDATA[0:0];
61
+ end
62
+
63
+
64
+ i2c_master i2c (
65
+ .sys_clk(PCLK),
66
+ .sys_rst(~PRESETn),
67
+ //
68
+ .io_a(PADDR[7:2]),
69
+ .io_di(PWDATA[7:0]),
70
+ .io_do(io_do),
71
+ .io_re(io_re),
72
+ .io_we(io_we),
73
+ //
74
+ .i2c_irq(i2c_irq),
75
+ //
76
+ .scl_i(scl_i), // SCL-line input
77
+ .scl_o(scl_o), // SCL-line output (always 1'b0)
78
+ .scl_oen_o(scl_oen_o), // SCL-line output enable (active low)
79
+ .sda_i(sda_i), // SDA-line input
80
+ .sda_o(sda_o), // SDA-line output (always 1'b0)
81
+ .sda_oen_o(sda_oen_o) // SDA-line output enable (active low)
82
+ );
83
+
84
+ assign PRDATA[31:0] = (PADDR[4:2] == 3'h7) ? I2C_IM_REG : io_do;//I2C_DATA_REG;
85
+
86
+ endmodule