Class: OrigenAhbDev::DUTController
- Inherits:
-
Object
- Object
- OrigenAhbDev::DUTController
- Includes:
- Origen::Controller
- Defined in:
- lib/origen_ahb_dev/dut_controller.rb
Instance Method Summary collapse
-
#ahb_trans(options = {}) ⇒ Object
Pin driver layer of AHB protocol, used by AHB.
-
#cleanup_pins ⇒ Object
Set pins to safe state for pattern end.
-
#init_pins ⇒ Object
Set pins to initial pin value.
-
#read_register(reg_or_val, options = {}) ⇒ Object
Dut-level register read using AHB driver.
-
#shutdown(options = {}) ⇒ Object
Method called on any pattern shutdown to leave pin values in known state.
-
#startup(options = {}) ⇒ Object
Method called on any pattern startup to init timeset and pin values.
-
#write_register(reg_or_val, options = {}) ⇒ Object
Dut-level register write using AHB driver.
Instance Method Details
#ahb_trans(options = {}) ⇒ Object
Pin driver layer of AHB protocol, used by AHB
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/origen_ahb_dev/dut_controller.rb', line 55 def ahb_trans( = {}) pin(:hclk).drive(0) pins(:htrans).drive(0) pin(:hwrite).drive(0) pin(:hsize).drive(0) pin(:hburst).drive(0) pin(:hmastlock).drive(0) pin(:hprot).drive(0) pin(:hready).dont_care pins(:haddr).dont_care pins(:hwdata).dont_care pins(:hrdata).dont_care tester.cycle # Address Phase # # Master drives the address and control signals onto bus after the rising edge of HCLK pin(:hclk).drive(1) tester.cycle pin(:htrans).drive(0b00) pin(:hwrite).drive([:hwrite]) pin(:hsize).drive([:hsize]) pin(:hburst).drive([:hburst]) pin(:hmastlock).drive([:hmastlock]) pin(:hprot).drive([:hprot]) pins(:haddr).drive([:haddr]) pin(:hclk).drive(0) tester.cycle # Data Phase # # Slave samples the address and control information on the next rising edge of HCLK pin(:hclk).drive(1) tester.cycle pin(:hclk).drive(0) pin(:hready).compare(1) pins(:hwdata).drive([:hdata]) if [:hwrite] == 1 tester.cycle pin(:hclk).drive(1) pins(:hrdata).assert([:hdata]) if [:hwrite] == 0 tester.cycle pin(:hclk).drive(0) tester.cycle pin(:hclk).drive(1) pins(:htrans).drive(0) pin(:hwrite).drive(0) pin(:hsize).drive(0) pin(:hburst).drive(0) pin(:hmastlock).drive(0) pin(:hprot).drive(0) pin(:hready).dont_care pins(:haddr).dont_care pins(:hwdata).dont_care pins(:hrdata).dont_care tester.cycle pin(:hclk).drive(0) tester.cycle end |
#cleanup_pins ⇒ Object
Set pins to safe state for pattern end
36 37 38 39 40 41 42 |
# File 'lib/origen_ahb_dev/dut_controller.rb', line 36 def cleanup_pins pin(:resetb).drive(0) pin(:tclk).drive(0) pin(:tdi).drive(0) pin(:tms).drive(0) pin(:tdo).dont_care end |
#init_pins ⇒ Object
Set pins to initial pin value
27 28 29 30 31 32 33 |
# File 'lib/origen_ahb_dev/dut_controller.rb', line 27 def init_pins pin(:resetb).drive(0) pin(:tclk).drive(0) pin(:tdi).drive(0) pin(:tms).drive(0) pin(:tdo).dont_care end |
#read_register(reg_or_val, options = {}) ⇒ Object
Dut-level register read using AHB driver
50 51 52 |
# File 'lib/origen_ahb_dev/dut_controller.rb', line 50 def read_register(reg_or_val, = {}) ahb.read_register(reg_or_val, ) end |
#shutdown(options = {}) ⇒ Object
Method called on any pattern shutdown to leave pin values in known state
18 19 20 21 22 23 24 |
# File 'lib/origen_ahb_dev/dut_controller.rb', line 18 def shutdown( = {}) # Shut everything down tester.wait time_in_ns: 250 pin(:resetb).drive(0) cleanup_pins # Give patterns a known exit condition end |
#startup(options = {}) ⇒ Object
Method called on any pattern startup to init timeset and pin values
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/origen_ahb_dev/dut_controller.rb', line 6 def startup( = {}) tester.set_timeset('ahb', 40) init_pins # Give pattern a known start up # Do some startup stuff here pin(:resetb).drive(0) tester.wait time_in_ns: 250 pin(:resetb).drive(1) end |
#write_register(reg_or_val, options = {}) ⇒ Object
Dut-level register write using AHB driver
45 46 47 |
# File 'lib/origen_ahb_dev/dut_controller.rb', line 45 def write_register(reg_or_val, = {}) ahb.write_register(reg_or_val, ) end |