Class: OrigenAhbDev::DUTController

Inherits:
Object
  • Object
show all
Includes:
Origen::Controller
Defined in:
lib/origen_ahb_dev/dut_controller.rb

Instance Method Summary collapse

Instance Method Details

#ahb_trans(options = {}) ⇒ Object



48
49
50
51
52
53
54
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
# File 'lib/origen_ahb_dev/dut_controller.rb', line 48

def ahb_trans(options = {})
  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(options[:hwrite])
  pin(:hsize).drive(options[:hsize])
  pin(:hburst).drive(options[:hburst])
  pin(:hmastlock).drive(options[:hmastlock])
  pin(:hprot).drive(options[:hprot])
  pins(:haddr).drive(options[: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(options[:hdata]) if options[:hwrite] == 1
  tester.cycle

  pin(:hclk).drive(1)
  pins(:hrdata).assert(options[:hdata]) if options[: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_pinsObject



32
33
34
35
36
37
38
# File 'lib/origen_ahb_dev/dut_controller.rb', line 32

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_pinsObject



24
25
26
27
28
29
30
# File 'lib/origen_ahb_dev/dut_controller.rb', line 24

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, options = {}) ⇒ Object



44
45
46
# File 'lib/origen_ahb_dev/dut_controller.rb', line 44

def read_register(reg, options = {})
  ahb.read_register(reg, options)
end

#shutdown(options = {}) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/origen_ahb_dev/dut_controller.rb', line 16

def shutdown(options = {})
  # 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



5
6
7
8
9
10
11
12
13
14
# File 'lib/origen_ahb_dev/dut_controller.rb', line 5

def startup(options = {})
  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, options = {}) ⇒ Object



40
41
42
# File 'lib/origen_ahb_dev/dut_controller.rb', line 40

def write_register(reg, options = {})
  ahb.write_register(reg, options)
end