From b460bee3f3b6be02d9c78d8407222fc485d860b9 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Mon, 4 Mar 2019 09:07:16 +0000 Subject: [PATCH] comments and whitespace cleanup --- TLB/src/PermissionValidator.py | 35 ++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/TLB/src/PermissionValidator.py b/TLB/src/PermissionValidator.py index 7cc12d93..dc7ae88f 100644 --- a/TLB/src/PermissionValidator.py +++ b/TLB/src/PermissionValidator.py @@ -1,30 +1,33 @@ from nmigen import Signal from nmigen.cli import main -# The purpose of this Module is to check the Permissions of a given PTE -# against the requested access permissions. -# This module will either validate (by setting the valid bit HIGH) the request -# or find a permission fault and invalidate (by setting the valid bit LOW) -# the request -# -# Arguments: -# data_size: (bit count) The size of the data words being processed -# -# Return: -# 1. Data is valid -> valid is HIGH -# 2. Data is not valid -> valid is LOW class PermissionValidator(): + """ The purpose of this Module is to check the Permissions of a given PTE + against the requested access permissions. + + This module will either validate (by setting the valid bit HIGH) + the request or find a permission fault and invalidate (by setting + the valid bit LOW) the request + """ + def __init__(self, data_size): + """ Arguments: + * data_size: (bit count) The size of the data words being processed + + Return: + 1. Data is valid -> valid is HIGH + 2. Data is not valid -> valid is LOW + """ # Input self.data = Signal(data_size); self.xwr = Signal(3) # Execute, Write, Read self.super = Signal(1) # Supervisor Mode self.super_access = Signal(1) # Supervisor Access self.asid = Signal(15) # Address Space IDentifier (ASID) - + # Output self.valid = Signal(1) # Denotes if the permissions are correct - + def elaborate(self, platform): m = Module() m.d.comb += [ @@ -49,11 +52,11 @@ class PermissionValidator(): If(data[4] == 1, self.valid.eq(1) ).Else( - self.valid.eq(0) + self.valid.eq(0) ) ) ).Else( - self.valid.eq(0) + self.valid.eq(0) ) ).Else( self.valid.eq(0) -- 2.30.2